From 0989bb0b9087e74662f546d13b2f16544cfba20b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 6 Jun 2009 20:03:13 +0000 Subject: GOB: Got rid of class ReferenceCounter; changed SurfaceDesc::Ptr to SurfaceDescPtr (a Common::SharedPtr); and changed many SurfaceDesc pointers to references svn-id: r41299 --- engines/gob/demos/demoplayer.cpp | 2 +- engines/gob/draw.cpp | 30 +++++---------- engines/gob/draw.h | 20 +++++----- engines/gob/draw_v1.cpp | 38 +++++++++---------- engines/gob/draw_v2.cpp | 54 +++++++++++++-------------- engines/gob/driver_vga.cpp | 80 ++++++++++++++++++++-------------------- engines/gob/driver_vga.h | 14 +++---- engines/gob/game.cpp | 2 +- engines/gob/game_v1.cpp | 4 +- engines/gob/game_v2.cpp | 2 +- engines/gob/global.cpp | 2 - engines/gob/global.h | 2 +- engines/gob/gob.cpp | 4 +- engines/gob/goblin.cpp | 2 +- engines/gob/helper.h | 52 -------------------------- engines/gob/init.cpp | 4 +- engines/gob/init_v2.cpp | 2 +- engines/gob/inter_bargon.cpp | 20 +++++----- engines/gob/inter_v1.cpp | 16 ++++---- engines/gob/inter_v2.cpp | 4 +- engines/gob/inter_v3.cpp | 2 +- engines/gob/inter_v4.cpp | 10 ++--- engines/gob/inter_v5.cpp | 20 +++++----- engines/gob/inter_v6.cpp | 4 +- engines/gob/mult.cpp | 7 ++-- engines/gob/mult.h | 2 +- engines/gob/mult_v1.cpp | 8 ++-- engines/gob/mult_v2.cpp | 8 ++-- engines/gob/save/savefile.cpp | 22 ++++------- engines/gob/save/savefile.h | 4 +- engines/gob/save/savehandler.cpp | 12 +++--- engines/gob/save/savehandler.h | 4 +- engines/gob/scenery.cpp | 6 +-- engines/gob/video.cpp | 80 ++++++++++++++++++++-------------------- engines/gob/video.h | 67 +++++++++++++++++---------------- engines/gob/video_v1.cpp | 15 +++----- engines/gob/video_v2.cpp | 15 +++----- engines/gob/video_v6.cpp | 45 +++++++++++----------- engines/gob/videoplayer.cpp | 2 +- 39 files changed, 304 insertions(+), 383 deletions(-) (limited to 'engines') diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index c1fde0b637..10527638f6 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -200,7 +200,7 @@ void DemoPlayer::playVideoDoubled() { int16 wD = (state.left * 2) + (w * 2); int16 hD = (state.top * 2) + (h * 2); - _vm->_video->drawSpriteDouble(_vm->_draw->_spritesArray[0], _vm->_draw->_frontSurface, + _vm->_video->drawSpriteDouble(*_vm->_draw->_spritesArray[0], *_vm->_draw->_frontSurface, state.left, state.top, state.right, state.bottom, state.left, state.top, 0); _vm->_draw->dirtiedRect(_vm->_draw->_frontSurface, state.left * 2, state.top * 2, wD, hD); diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index 73facb4ac3..3ec9b8b436 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -62,9 +62,6 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { for (int i = 0; i < 8; i++) _fonts[i] = 0; - for (int i = 0; i < SPRITES_COUNT; i++) - _spritesArray[i] = 0; - _invalidatedCount = 0; for (int i = 0; i < 30; i++) { _invalidatedTops[i] = 0; @@ -78,9 +75,6 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { _paletteCleared = false; _applyPal = false; - _backSurface = 0; - _frontSurface = 0; - for (int i = 0; i < 18; i++) _unusedPalette1[i] = 0; for (int i = 0; i < 16; i++) @@ -109,10 +103,6 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { _cursorHotspotXVar = -1; _cursorHotspotYVar = -1; - _cursorSprites = 0; - _cursorSpritesBack = 0; - _scummvmCursor = 0; - _cursorAnim = 0; for (int i = 0; i < 40; i++) { _cursorAnimLow[i] = 0; @@ -265,7 +255,7 @@ void Draw::blitInvalidated() { _vm->_video->_doRangeClamp = false; for (int i = 0; i < _invalidatedCount; i++) { - _vm->_video->drawSprite(_backSurface, _frontSurface, + _vm->_video->drawSprite(*_backSurface, *_frontSurface, _invalidatedLefts[i], _invalidatedTops[i], _invalidatedRights[i], _invalidatedBottoms[i], _invalidatedLefts[i], _invalidatedTops[i], 0); @@ -302,7 +292,7 @@ void Draw::dirtiedRect(int16 surface, dirtiedRect(_spritesArray[surface], left, top, right, bottom); } -void Draw::dirtiedRect(SurfaceDesc::Ptr surface, +void Draw::dirtiedRect(SurfaceDescPtr surface, int16 left, int16 top, int16 right, int16 bottom) { if (surface == _backSurface) @@ -316,7 +306,7 @@ void Draw::initSpriteSurf(int16 index, int16 width, int16 height, _spritesArray[index] = _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, flags); - _vm->_video->clearSurf(_spritesArray[index]); + _vm->_video->clearSurf(*_spritesArray[index]); } void Draw::adjustCoords(char adjust, int16 *coord1, int16 *coord2) { @@ -379,7 +369,7 @@ int Draw::stringLength(const char *str, int16 fontIndex) { } void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, SurfaceDesc *dest, Video::FontDesc *font) { + int16 transp, SurfaceDesc &dest, Video::FontDesc *font) { while (*str != '\0') { _vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest); @@ -447,7 +437,7 @@ int32 Draw::getSpriteRectSize(int16 index) { } void Draw::forceBlit(bool backwards) { - if ((_frontSurface == 0) || (_backSurface == 0)) + if (!_frontSurface || !_backSurface) return; if (_frontSurface == _backSurface) return; @@ -457,12 +447,12 @@ void Draw::forceBlit(bool backwards) { return; if (!backwards) { - _vm->_video->drawSprite(_backSurface, _frontSurface, 0, 0, + _vm->_video->drawSprite(*_backSurface, *_frontSurface, 0, 0, _backSurface->getWidth() - 1, _backSurface->getHeight() - 1, 0, 0, 0); _vm->_video->dirtyRectsAll(); } else - _vm->_video->drawSprite(_frontSurface, _backSurface, 0, 0, + _vm->_video->drawSprite(*_frontSurface, *_backSurface, 0, 0, _frontSurface->getWidth() - 1, _frontSurface->getHeight() - 1, 0, 0, 0); @@ -511,7 +501,7 @@ const int16 Draw::_wobbleTable[360] = { -0x0A03, -0x08E8, -0x07CC, -0x06B0, -0x0593, -0x0476, -0x0359, -0x023B, -0x011D }; -void Draw::wobble(SurfaceDesc *surfDesc) { +void Draw::wobble(SurfaceDesc &surfDesc) { int16 amplitude = 32; uint16 curFrame = 0; uint16 frameWobble = 0; @@ -535,7 +525,7 @@ void Draw::wobble(SurfaceDesc *surfDesc) { amplitude--; for (uint16 y = 0; y < _vm->_height; y++) - _vm->_video->drawSprite(surfDesc, _frontSurface, + _vm->_video->drawSprite(surfDesc, *_frontSurface, 0, y, _vm->_width - 1, y, offsets[y], y, 0); _vm->_palAnim->fadeStep(0); @@ -543,7 +533,7 @@ void Draw::wobble(SurfaceDesc *surfDesc) { _vm->_video->waitRetrace(); } - _vm->_video->drawSprite(surfDesc, _frontSurface, + _vm->_video->drawSprite(surfDesc, *_frontSurface, 0, 0, _vm->_width - 1, _vm->_height - 1, 0, 0, 0); _applyPal = false; diff --git a/engines/gob/draw.h b/engines/gob/draw.h index ccdd91d1e4..bfd72429e4 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -78,7 +78,7 @@ public: FontToSprite _fontToSprite[4]; Video::FontDesc *_fonts[8]; - SurfaceDesc::Ptr _spritesArray[SPRITES_COUNT]; + SurfaceDescPtr _spritesArray[SPRITES_COUNT]; int16 _invalidatedCount; int16 _invalidatedTops[30]; @@ -92,8 +92,8 @@ public: bool _paletteCleared; bool _applyPal; - SurfaceDesc::Ptr _backSurface; - SurfaceDesc::Ptr _frontSurface; + SurfaceDescPtr _backSurface; + SurfaceDescPtr _frontSurface; int16 _unusedPalette1[18]; int16 _unusedPalette2[16]; @@ -117,9 +117,9 @@ public: int16 _cursorHotspotXVar; int16 _cursorHotspotYVar; - SurfaceDesc::Ptr _cursorSprites; - SurfaceDesc::Ptr _cursorSpritesBack; - SurfaceDesc::Ptr _scummvmCursor; + SurfaceDescPtr _cursorSprites; + SurfaceDescPtr _cursorSpritesBack; + SurfaceDescPtr _scummvmCursor; int16 _cursorAnim; int8 _cursorAnimLow[40]; @@ -139,12 +139,12 @@ public: void clearPalette(); void dirtiedRect(int16 surface, int16 left, int16 top, int16 right, int16 bottom); - void dirtiedRect(SurfaceDesc::Ptr surface, int16 left, int16 top, int16 right, int16 bottom); + void dirtiedRect(SurfaceDescPtr surface, int16 left, int16 top, int16 right, int16 bottom); void initSpriteSurf(int16 index, int16 width, int16 height, int16 flags); void freeSprite(int16 index) { assert(index < SPRITES_COUNT); - _spritesArray[index] = 0; + _spritesArray[index].reset(); } void adjustCoords(char adjust, int16 *coord1, int16 *coord2); void adjustCoords(char adjust, uint16 *coord1, uint16 *coord2) { @@ -152,14 +152,14 @@ public: } int stringLength(const char *str, int16 fontIndex); void drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, SurfaceDesc *dest, Video::FontDesc *font); + int16 transp, SurfaceDesc &dest, Video::FontDesc *font); void printTextCentered(int16 id, int16 left, int16 top, int16 right, int16 bottom, const char *str, int16 fontIndex, int16 color); int32 getSpriteRectSize(int16 index); void forceBlit(bool backwards = false); static const int16 _wobbleTable[360]; - void wobble(SurfaceDesc *surfDesc); + void wobble(SurfaceDesc &surfDesc); virtual void initScreen() = 0; virtual void closeScreen() = 0; diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 1943c327d8..de71f20142 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -131,8 +131,8 @@ void Draw_v1::animateCursor(int16 cursor) { newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar); } - _vm->_video->clearSurf(_scummvmCursor); - _vm->_video->drawSprite(_cursorSprites, _scummvmCursor, + _vm->_video->clearSurf(*_scummvmCursor); + _vm->_video->drawSprite(*_cursorSprites, *_scummvmCursor, cursorIndex * _cursorWidth, 0, (cursorIndex + 1) * _cursorWidth - 1, _cursorHeight - 1, 0, 0, 0); @@ -354,8 +354,8 @@ void Draw_v1::spriteOperation(int16 operation) { switch (operation) { case DRAW_BLITSURF: - _vm->_video->drawSprite(_spritesArray[_sourceSurface], - _spritesArray[_destSurface], + _vm->_video->drawSprite(*_spritesArray[_sourceSurface], + *_spritesArray[_destSurface], _spriteLeft, _spriteTop, _spriteLeft + _spriteRight - 1, _spriteTop + _spriteBottom - 1, @@ -367,13 +367,13 @@ void Draw_v1::spriteOperation(int16 operation) { case DRAW_PUTPIXEL: _vm->_video->putPixel(_destSpriteX, _destSpriteY, - _frontColor, _spritesArray[_destSurface]); + _frontColor, *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX, _destSpriteY); break; case DRAW_FILLRECT: - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1, _backColor); @@ -383,7 +383,7 @@ void Draw_v1::spriteOperation(int16 operation) { break; case DRAW_DRAWLINE: - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); @@ -403,7 +403,7 @@ void Draw_v1::spriteOperation(int16 operation) { _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, - _transparency, _spritesArray[_destSurface]); + _transparency, *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1); delete[] dataBuf; @@ -416,7 +416,7 @@ void Draw_v1::spriteOperation(int16 operation) { _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, - _transparency, _spritesArray[_destSurface]); + _transparency, *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1); @@ -434,26 +434,26 @@ void Draw_v1::spriteOperation(int16 operation) { _fonts[_fontIndex], _transparency, _frontColor, _backColor, - _spritesArray[_destSurface]); + *_spritesArray[_destSurface]); _destSpriteX += _fonts[_fontIndex]->itemWidth; } break; case DRAW_DRAWBAR: - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _spriteBottom, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _destSpriteX, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _spriteRight, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _destSpriteY, _frontColor); @@ -462,7 +462,7 @@ void Draw_v1::spriteOperation(int16 operation) { case DRAW_CLEARRECT: if (_backColor < 16) { - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _backColor); @@ -471,7 +471,7 @@ void Draw_v1::spriteOperation(int16 operation) { break; case DRAW_FILLRECTABS: - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _backColor); @@ -488,7 +488,7 @@ void Draw_v1::spriteOperation(int16 operation) { _fonts[_fontIndex], _transparency, _frontColor, _backColor, - _spritesArray[_destSurface]); + *_spritesArray[_destSurface]); break; } @@ -506,8 +506,8 @@ void Draw_v1::spriteOperation(int16 operation) { _destSpriteX + _fontToSprite[_fontIndex].width, _destSpriteY + _fontToSprite[_fontIndex].height); - _vm->_video->drawSprite(_spritesArray[(int16)_fontToSprite[_fontIndex].sprite], - _spritesArray[_destSurface], x, y, + _vm->_video->drawSprite(*_spritesArray[(int16)_fontToSprite[_fontIndex].sprite], + *_spritesArray[_destSurface], x, y, x + _fontToSprite[_fontIndex].width, y + _fontToSprite[_fontIndex].height, _destSpriteX, _destSpriteY, _transparency); diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 852e0b51fb..4bb8120e3a 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -48,7 +48,7 @@ void Draw_v2::initScreen() { initSpriteSurf(21, _vm->_video->_surfWidth, _vm->_video->_surfHeight, 0); _backSurface = _spritesArray[21]; - _vm->_video->clearSurf(_backSurface); + _vm->_video->clearSurf(*_backSurface); if (!_spritesArray[23]) { initSpriteSurf(23, 32, 16, 2); @@ -162,8 +162,8 @@ void Draw_v2::animateCursor(int16 cursor) { newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar); } - _vm->_video->clearSurf(_scummvmCursor); - _vm->_video->drawSprite(_cursorSprites, _scummvmCursor, + _vm->_video->clearSurf(*_scummvmCursor); + _vm->_video->drawSprite(*_cursorSprites, *_scummvmCursor, cursorIndex * _cursorWidth, 0, (cursorIndex + 1) * _cursorWidth - 1, _cursorHeight - 1, 0, 0, 0); @@ -614,7 +614,7 @@ void Draw_v2::spriteOperation(int16 operation) { byte *dataBuf; int16 len; int16 x, y; - SurfaceDesc *sourceSurf, *destSurf; + SurfaceDescPtr sourceSurf, destSurf; bool deltaVeto; int16 left; int16 ratio; @@ -711,8 +711,8 @@ void Draw_v2::spriteOperation(int16 operation) { if (!sourceSurf || !destSurf) break; - _vm->_video->drawSprite(_spritesArray[_sourceSurface], - _spritesArray[_destSurface], + _vm->_video->drawSprite(*_spritesArray[_sourceSurface], + *_spritesArray[_destSurface], _spriteLeft, spriteTop, _spriteLeft + _spriteRight - 1, _spriteTop + _spriteBottom - 1, @@ -724,13 +724,13 @@ void Draw_v2::spriteOperation(int16 operation) { case DRAW_PUTPIXEL: _vm->_video->putPixel(_destSpriteX, _destSpriteY, _frontColor, - _spritesArray[_destSurface]); + *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX, _destSpriteY); break; case DRAW_FILLRECT: - _vm->_video->fillRect(_spritesArray[_destSurface], destSpriteX, + _vm->_video->fillRect(*_spritesArray[_destSurface], destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1, _backColor); @@ -739,7 +739,7 @@ void Draw_v2::spriteOperation(int16 operation) { break; case DRAW_DRAWLINE: - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); @@ -747,7 +747,7 @@ void Draw_v2::spriteOperation(int16 operation) { break; case DRAW_INVALIDATE: - _vm->_video->drawCircle(_spritesArray[_destSurface], _destSpriteX, + _vm->_video->drawCircle(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _frontColor); dirtiedRect(_destSurface, _destSpriteX - _spriteRight, _destSpriteY - _spriteBottom, @@ -770,7 +770,7 @@ void Draw_v2::spriteOperation(int16 operation) { _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, - _transparency, _spritesArray[_destSurface]); + _transparency, *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1); @@ -786,7 +786,7 @@ void Draw_v2::spriteOperation(int16 operation) { _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, - _transparency, _spritesArray[_destSurface]); + _transparency, *_spritesArray[_destSurface]); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1); @@ -807,11 +807,11 @@ void Draw_v2::spriteOperation(int16 operation) { for (int i = 0; i < len; i++, dataBuf += 2) { _vm->_video->drawLetter(READ_LE_UINT16(dataBuf), _destSpriteX, _destSpriteY, _fonts[_fontIndex], _transparency, _frontColor, - _backColor, _spritesArray[_destSurface]); + _backColor, *_spritesArray[_destSurface]); } } else { drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, - _backColor, _transparency, _spritesArray[_destSurface], + _backColor, _transparency, *_spritesArray[_destSurface], _fonts[_fontIndex]); _destSpriteX += len * _fonts[_fontIndex]->itemWidth; } @@ -820,7 +820,7 @@ void Draw_v2::spriteOperation(int16 operation) { if ((someHandle < 0) || (_textToPrint[i] != ' ')) { _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, _destSpriteY, _fonts[_fontIndex], _transparency, - _frontColor, _backColor, _spritesArray[_destSurface]); + _frontColor, _backColor, *_spritesArray[_destSurface]); _destSpriteX += *(_fonts[_fontIndex]->extraData + (_textToPrint[i] - _fonts[_fontIndex]->startItem)); } @@ -839,8 +839,8 @@ void Draw_v2::spriteOperation(int16 operation) { * _fontToSprite[_fontIndex].height; x = ((_textToPrint[i] - _fontToSprite[_fontIndex].base) % ratio) * _fontToSprite[_fontIndex].width; - _vm->_video->drawSprite(_spritesArray[_fontToSprite[_fontIndex].sprite], - _spritesArray[_destSurface], x, y, + _vm->_video->drawSprite(*_spritesArray[_fontToSprite[_fontIndex].sprite], + *_spritesArray[_destSurface], x, y, x + _fontToSprite[_fontIndex].width - 1, y + _fontToSprite[_fontIndex].height - 1, _destSpriteX, _destSpriteY, _transparency); @@ -854,35 +854,35 @@ void Draw_v2::spriteOperation(int16 operation) { case DRAW_DRAWBAR: if (_needAdjust != 2) { - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _spriteBottom - 1, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _destSpriteX + 1, _spriteBottom, _frontColor); - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _spriteRight - 1, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _destSpriteY + 1, _frontColor); } else { - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _spriteBottom, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _destSpriteX, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _spriteRight, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); - _vm->_video->drawLine(_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _destSpriteY, _frontColor); } @@ -892,7 +892,7 @@ void Draw_v2::spriteOperation(int16 operation) { case DRAW_CLEARRECT: if ((_backColor != 16) && (_backColor != 144)) { - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _backColor); @@ -902,7 +902,7 @@ void Draw_v2::spriteOperation(int16 operation) { break; case DRAW_FILLRECTABS: - _vm->_video->fillRect(_spritesArray[_destSurface], + _vm->_video->fillRect(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _backColor); diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index 24c2d8e37b..aff971164f 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -38,26 +38,26 @@ static void plotPixel(int x, int y, int color, void *data) { dest->getVidMem()[(y * dest->getWidth()) + x] = color; } -void VGAVideoDriver::putPixel(int16 x, int16 y, byte color, SurfaceDesc *dest) { - if ((x >= 0) && (x < dest->getWidth()) && - (y >= 0) && (y < dest->getHeight())) - dest->getVidMem()[(y * dest->getWidth()) + x] = color; +void VGAVideoDriver::putPixel(int16 x, int16 y, byte color, SurfaceDesc &dest) { + if ((x >= 0) && (x < dest.getWidth()) && + (y >= 0) && (y < dest.getHeight())) + dest.getVidMem()[(y * dest.getWidth()) + x] = color; } -void VGAVideoDriver::drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, +void VGAVideoDriver::drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) { - Graphics::drawLine(x0, y0, x1, y1, color, &plotPixel, dest); + Graphics::drawLine(x0, y0, x1, y1, color, &plotPixel, &dest); } -void VGAVideoDriver::fillRect(SurfaceDesc *dest, int16 left, int16 top, +void VGAVideoDriver::fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color) { - if ((left >= dest->getWidth()) || (right >= dest->getWidth()) || - (top >= dest->getHeight()) || (bottom >= dest->getHeight())) + if ((left >= dest.getWidth()) || (right >= dest.getWidth()) || + (top >= dest.getHeight()) || (bottom >= dest.getHeight())) return; - byte *pos = dest->getVidMem() + (top * dest->getWidth()) + left; + byte *pos = dest.getVidMem() + (top * dest.getWidth()) + left; int16 width = (right - left) + 1; int16 height = (bottom - top) + 1; @@ -65,19 +65,19 @@ void VGAVideoDriver::fillRect(SurfaceDesc *dest, int16 left, int16 top, for (int16 i = 0; i < width; ++i) pos[i] = color; - pos += dest->getWidth(); + pos += dest.getWidth(); } } void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, - byte transp, SurfaceDesc *dest) { + byte transp, SurfaceDesc &dest) { byte *src, *dst; uint16 data; src = fontDesc->dataPtr + (item - fontDesc->startItem) * (fontDesc->itemSize & 0xFF); - dst = dest->getVidMem() + x + dest->getWidth() * y; + dst = dest.getVidMem() + x + dest.getWidth() * y; int nWidth = fontDesc->itemWidth; @@ -106,26 +106,26 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, } - dst += dest->getWidth() - fontDesc->itemWidth; + dst += dest.getWidth() - fontDesc->itemWidth; } } -void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, +void VGAVideoDriver::drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) { - if ((x >= dest->getWidth()) || (x < 0) || - (y >= dest->getHeight()) || (y < 0)) + if ((x >= dest.getWidth()) || (x < 0) || + (y >= dest.getHeight()) || (y < 0)) return; - int16 width = MIN((right - left) + 1, (int) dest->getWidth()); - int16 height = MIN((bottom - top) + 1, (int) dest->getHeight()); + int16 width = MIN((right - left) + 1, (int) dest.getWidth()); + int16 height = MIN((bottom - top) + 1, (int) dest.getHeight()); if ((width < 1) || (height < 1)) return; - const byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left; - byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x; + const byte *srcPos = source.getVidMem() + (top * source.getWidth()) + left; + byte *destPos = dest.getVidMem() + (y * dest.getWidth()) + x; uint32 size = width * height; @@ -137,8 +137,8 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, destPos[i] = srcPos[i]; } - srcPos += source->getWidth(); - destPos += dest->getWidth(); + srcPos += source.getWidth(); + destPos += dest.getWidth(); } } else if (((srcPos >= destPos) && (srcPos <= (destPos + size))) || @@ -147,8 +147,8 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, while (height--) { memmove(destPos, srcPos, width); - srcPos += source->getWidth(); - destPos += dest->getWidth(); + srcPos += source.getWidth(); + destPos += dest.getWidth(); } } else { @@ -156,29 +156,29 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, while (height--) { memcpy(destPos, srcPos, width); - srcPos += source->getWidth(); - destPos += dest->getWidth(); + srcPos += source.getWidth(); + destPos += dest.getWidth(); } } } -void VGAVideoDriver::drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, +void VGAVideoDriver::drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) { - if ((x >= dest->getWidth()) || (x < 0) || - (y >= dest->getHeight()) || (y < 0)) + if ((x >= dest.getWidth()) || (x < 0) || + (y >= dest.getHeight()) || (y < 0)) return; - int16 width = MIN((right - left) + 1, dest->getWidth() / 2); - int16 height = MIN((bottom - top) + 1, dest->getHeight() / 2); + int16 width = MIN((right - left) + 1, dest.getWidth() / 2); + int16 height = MIN((bottom - top) + 1, dest.getHeight() / 2); if ((width < 1) || (height < 1)) return; - const byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left; - byte *destPos = dest->getVidMem() + ((y * 2) * dest->getWidth()) + (x * 2); + const byte *srcPos = source.getVidMem() + (top * source.getWidth()) + left; + byte *destPos = dest.getVidMem() + ((y * 2) * dest.getWidth()) + (x * 2); while (height--) { const byte *srcBak = srcPos; @@ -193,19 +193,19 @@ void VGAVideoDriver::drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, } } - destPos += dest->getWidth(); + destPos += dest.getWidth(); } - srcPos = srcBak + source->getWidth(); + srcPos = srcBak + source.getWidth(); } } void VGAVideoDriver::drawPackedSprite(byte *sprBuf, int16 width, int16 height, - int16 x, int16 y, byte transp, SurfaceDesc *dest) { + int16 x, int16 y, byte transp, SurfaceDesc &dest) { int destRight = x + width; int destBottom = y + height; - byte *dst = dest->getVidMem() + x + dest->getWidth() * y; + byte *dst = dest.getVidMem() + x + dest.getWidth() * y; int curx = x; int cury = y; @@ -223,14 +223,14 @@ void VGAVideoDriver::drawPackedSprite(byte *sprBuf, int16 width, int16 height, val >>= 4; for (unsigned int i = 0; i < repeat; ++i) { - if (curx < dest->getWidth() && cury < dest->getHeight()) + if (curx < dest.getWidth() && cury < dest.getHeight()) if (!transp || val) *dst = val; dst++; curx++; if (curx == destRight) { - dst += dest->getWidth() + x - curx; + dst += dest.getWidth() + x - curx; curx = x; cury++; if (cury == destBottom) diff --git a/engines/gob/driver_vga.h b/engines/gob/driver_vga.h index c67fd1cb2f..c50ea5c475 100644 --- a/engines/gob/driver_vga.h +++ b/engines/gob/driver_vga.h @@ -35,20 +35,20 @@ public: VGAVideoDriver() {} virtual ~VGAVideoDriver() {} - void putPixel(int16 x, int16 y, byte color, SurfaceDesc *dest); - void drawLine(SurfaceDesc *dest, int16 x0, int16 y0, + void putPixel(int16 x, int16 y, byte color, SurfaceDesc &dest); + void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color); - void fillRect(SurfaceDesc *dest, int16 left, int16 top, + void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color); void drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, - byte transp, SurfaceDesc *dest); - void drawSprite(SurfaceDesc *source, SurfaceDesc *dest, int16 left, + byte transp, SurfaceDesc &dest); + void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); - void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, int16 left, + void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); void drawPackedSprite(byte *sprBuf, int16 width, int16 height, - int16 x, int16 y, byte transp, SurfaceDesc *dest); + int16 x, int16 y, byte transp, SurfaceDesc &dest); }; } diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index d5c81098cc..09addc3900 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -526,7 +526,7 @@ void Game::start(void) { for (int i = 0; i < SPRITES_COUNT; i++) _vm->_draw->freeSprite(i); - _vm->_draw->_scummvmCursor = 0; + _vm->_draw->_scummvmCursor.reset(); } // flagbits: 0 = freeInterVariables, 1 = skipPlay diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index b46cc00f90..ad24d7d9c6 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -549,9 +549,9 @@ void Game_v1::prepareStart(void) { _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); _vm->_draw->initScreen(); - _vm->_video->fillRect(_vm->_draw->_backSurface, 0, 0, 319, 199, 1); + _vm->_video->fillRect(*_vm->_draw->_backSurface, 0, 0, 319, 199, 1); _vm->_draw->_frontSurface = _vm->_global->_primarySurfDesc; - _vm->_video->fillRect(_vm->_draw->_frontSurface, 0, 0, 319, 199, 1); + _vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, 319, 199, 1); _vm->_util->setMousePos(152, 92); _vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 777eae14bc..e9656efa32 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -571,7 +571,7 @@ void Game_v2::prepareStart(void) { _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); _vm->_draw->initScreen(); - _vm->_video->fillRect(_vm->_draw->_frontSurface, 0, 0, + _vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, _vm->_video->_surfWidth - 1, _vm->_video->_surfHeight - 1, 1); _vm->_util->setMousePos(152, 92); diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 8283552f2c..005d65815f 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -112,8 +112,6 @@ Global::Global(GobEngine *vm) : _vm(vm) { _setAllPalette = false; _dontSetPalette = false; - _primarySurfDesc = 0; - _debugFlag = 0; _inVM = 0; diff --git a/engines/gob/global.h b/engines/gob/global.h index 5c63f2b68a..9f12f4ded6 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -112,7 +112,7 @@ public: bool _setAllPalette; bool _dontSetPalette; - SurfaceDesc::Ptr _primarySurfDesc; + SurfaceDescPtr _primarySurfDesc; int16 _debugFlag; int16 _inVM; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 71d89912ba..9eeb82ad6f 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -479,14 +479,14 @@ bool GobEngine::initGameParts() { _global->_mouseMaxX = 640; _global->_mouseMaxY = 480; _mode = 0x18; - _global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480); + _global->_primarySurfDesc = SurfaceDescPtr(new SurfaceDesc(0x18, 640, 480)); } else { _video->_surfWidth = _width = 320; _video->_surfHeight = _video->_splitHeight1 = _height = 200; _global->_mouseMaxX = 320; _global->_mouseMaxY = 200; _mode = 0x14; - _global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200); + _global->_primarySurfDesc = SurfaceDescPtr(new SurfaceDesc(0x14, 320, 200)); } return true; diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index 90303e46a7..45fb643166 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -233,7 +233,7 @@ void Goblin::drawObjects(void) { if (objDesc->toRedraw == 0) continue; - _vm->_video->drawSprite(_vm->_mult->_animSurf, _vm->_draw->_backSurface, + _vm->_video->drawSprite(*_vm->_mult->_animSurf, *_vm->_draw->_backSurface, objDesc->left, objDesc->top, objDesc->right, objDesc->bottom, objDesc->left, objDesc->top, 0); diff --git a/engines/gob/helper.h b/engines/gob/helper.h index fbb5ae7ec8..d1f24792a5 100644 --- a/engines/gob/helper.h +++ b/engines/gob/helper.h @@ -35,58 +35,6 @@ inline char *strncpy0(char *dest, const char *src, size_t n) { return dest; } -/** A "smart" reference counting templated class. */ -template -class ReferenceCounter { -public: - class Ptr { - public: - bool operator==(const Ptr &p) const { return _p == p._p; } - bool operator==(const ReferenceCounter *p) const { return _p == p; } - - T *operator-> () { return _p; } - T &operator* () { return *_p; } - operator T*() { return _p; } - - Ptr(T *p) : _p(p) { ++_p->_references; } - Ptr() : _p(0) { } - - ~Ptr() { - if (_p && (--_p->_references == 0)) - delete _p; - } - - Ptr(const Ptr &p) : _p(p._p) { ++_p->_references; } - - Ptr &operator= (const Ptr &p) { - ++p._p->_references; - if (_p && (--_p->_references == 0)) - delete _p; - _p = p._p; - return *this; - } - Ptr *operator= (const Ptr *p) { - if (p) - ++p->_p->_references; - if (_p && (--_p->_references == 0)) - delete _p; - - _p = p ? p->_p : 0; - return this; - } - - private: - T *_p; - }; - - ReferenceCounter() : _references(0) { } - virtual ~ReferenceCounter() {} - -private: - unsigned _references; - friend class Ptr; -}; - } // End of namespace Gob #endif // GOB_HELPER_H diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index be14b71661..8bf9536286 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -50,7 +50,7 @@ Init::Init(GobEngine *vm) : _vm(vm) { void Init::cleanup() { _vm->_video->freeDriver(); - _vm->_global->_primarySurfDesc = 0; + _vm->_global->_primarySurfDesc.reset(); _vm->_sound->speakerOff(); _vm->_sound->blasterStop(0); @@ -213,7 +213,7 @@ void Init::initGame() { _vm->_dataIO->closeData(imdHandle); sprBuf = _vm->_dataIO->getData("coktel.ims"); _vm->_video->drawPackedSprite(sprBuf, 320, 200, 0, 0, 0, - _vm->_draw->_frontSurface); + *_vm->_draw->_frontSurface); _vm->_palAnim->fade(_palDesc, 0, 0); _vm->_util->delay(500); diff --git a/engines/gob/init_v2.cpp b/engines/gob/init_v2.cpp index 9c52bd2eea..4c65b8102c 100644 --- a/engines/gob/init_v2.cpp +++ b/engines/gob/init_v2.cpp @@ -42,7 +42,7 @@ void Init_v2::initVideo() { _vm->_draw->_frontSurface = _vm->_global->_primarySurfDesc; _vm->_video->initSurfDesc(_vm->_global->_videoMode, - _vm->_video->_surfWidth, _vm->_video->_surfHeight, 0x80); + _vm->_video->_surfWidth, _vm->_video->_surfHeight, PRIMARY_SURFACE); _vm->_global->_mousePresent = 1; diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index c729bf3c4c..e729c67f6a 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -734,16 +734,16 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { int16 mouseX; int16 mouseY; int16 buttons; - SurfaceDesc *surface; + SurfaceDescPtr surface; SoundDesc samples[4]; int16 comp[5] = { 0, 1, 2, 3, -1 }; static const char *sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"}; surface = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0); - _vm->_video->drawPackedSprite("2ille.ims", surface); - _vm->_video->drawSprite(surface, _vm->_draw->_frontSurface, 0, 0, 319, 199, 0, 0, 0); - _vm->_video->drawPackedSprite("2ille4.ims", surface); - _vm->_video->drawSprite(surface, _vm->_draw->_frontSurface, 0, 0, 319, 199, 320, 0, 0); + _vm->_video->drawPackedSprite("2ille.ims", *surface); + _vm->_video->drawSprite(*surface, *_vm->_draw->_frontSurface, 0, 0, 319, 199, 0, 0, 0); + _vm->_video->drawPackedSprite("2ille4.ims", *surface); + _vm->_video->drawSprite(*surface, *_vm->_draw->_frontSurface, 0, 0, 319, 199, 320, 0, 0); _vm->_util->setScrollOffset(320, 0); _vm->_video->dirtyRectsAll(); _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0); @@ -754,7 +754,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) || _vm->shouldQuit()) { _vm->_palAnim->fade(0, -2, 0); - _vm->_video->clearSurf(_vm->_draw->_frontSurface); + _vm->_video->clearSurf(*_vm->_draw->_frontSurface); memset((char *) _vm->_draw->_vgaPalette, 0, 768); WRITE_VAR(4, buttons); WRITE_VAR(0, 0x11B); @@ -766,7 +766,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { _vm->_util->setScrollOffset(0, 0); _vm->_video->dirtyRectsAll(); } - surface = 0; + surface.reset(); if (VAR(57) == ((uint32) -1)) return; @@ -775,7 +775,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { _vm->_sound->blasterPlayComposition(comp, 0, samples, 4); _vm->_sound->blasterWaitEndPlay(true, false); _vm->_palAnim->fade(0, 0, 0); - _vm->_video->clearSurf(_vm->_draw->_frontSurface); + _vm->_video->clearSurf(*_vm->_draw->_frontSurface); } void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { @@ -806,8 +806,8 @@ void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { _vm->shouldQuit()) { _vm->_sound->blasterStop(10); _vm->_palAnim->fade(0, -2, 0); - _vm->_video->clearSurf(_vm->_draw->_frontSurface); - memset((char *) _vm->_draw->_vgaPalette, 0, 768); + _vm->_video->clearSurf(*_vm->_draw->_frontSurface); + memset(_vm->_draw->_vgaPalette, 0, 768); WRITE_VAR(4, buttons); WRITE_VAR(0, 0x11B); WRITE_VAR(57, (uint32) -1); diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 37e31b95e8..9199fe074a 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -808,9 +808,9 @@ void Inter_v1::o1_initCursor() { (_vm->_draw->_cursorSprites->getWidth() != (width * count))) { _vm->_draw->freeSprite(23); - _vm->_draw->_cursorSprites = 0; - _vm->_draw->_cursorSpritesBack = 0; - _vm->_draw->_scummvmCursor = 0; + _vm->_draw->_cursorSprites.reset(); + _vm->_draw->_cursorSpritesBack.reset(); + _vm->_draw->_scummvmCursor.reset(); _vm->_draw->_cursorWidth = width; _vm->_draw->_cursorHeight = height; @@ -963,7 +963,7 @@ void Inter_v1::o1_initMult() { ((oldAnimWidth != _vm->_mult->_animWidth) || (oldAnimHeight != _vm->_mult->_animHeight))) { _vm->_draw->freeSprite(22); - _vm->_mult->_animSurf = 0; + _vm->_mult->_animSurf.reset(); } if (!_vm->_mult->_animSurf) { @@ -972,7 +972,7 @@ void Inter_v1::o1_initMult() { _vm->_mult->_animSurf = _vm->_draw->_spritesArray[22]; } - _vm->_video->drawSprite(_vm->_draw->_backSurface, _vm->_mult->_animSurf, + _vm->_video->drawSprite(*_vm->_draw->_backSurface, *_vm->_mult->_animSurf, _vm->_mult->_animLeft, _vm->_mult->_animTop, _vm->_mult->_animLeft + _vm->_mult->_animWidth - 1, _vm->_mult->_animTop + _vm->_mult->_animHeight - 1, 0, 0, 0); @@ -1177,13 +1177,13 @@ bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) { dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height); - _vm->_video->fillRect(_vm->_draw->_cursorSprites, + _vm->_video->fillRect(*_vm->_draw->_cursorSprites, index * _vm->_draw->_cursorWidth, 0, index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1, _vm->_draw->_cursorHeight - 1, 0); _vm->_video->drawPackedSprite(dataBuf, width, height, - index * _vm->_draw->_cursorWidth, 0, 0, _vm->_draw->_cursorSprites); + index * _vm->_draw->_cursorWidth, 0, 0, *_vm->_draw->_cursorSprites); _vm->_draw->_cursorAnimLow[index] = 0; return false; @@ -1531,7 +1531,7 @@ bool Inter_v1::o1_palLoad(OpFuncParams ¶ms) { } } if (!allZero) { - _vm->_video->clearSurf(_vm->_draw->_frontSurface); + _vm->_video->clearSurf(*_vm->_draw->_frontSurface); _vm->_draw->_noInvalidated57 = true; _vm->_global->_inter_execPtr += 18; return false; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 2c6a9e373c..bb77951573 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -907,12 +907,12 @@ void Inter_v2::o2_initMult() { ((oldAnimWidth != _vm->_mult->_animWidth) || (oldAnimHeight != _vm->_mult->_animHeight))) { _vm->_draw->freeSprite(22); - _vm->_mult->_animSurf = 0; + _vm->_mult->_animSurf.reset(); } _vm->_draw->adjustCoords(0, &_vm->_mult->_animWidth, &_vm->_mult->_animHeight); - if (_vm->_mult->_animSurf == 0) { + if (!_vm->_mult->_animSurf) { _vm->_draw->initSpriteSurf(22, _vm->_mult->_animWidth, _vm->_mult->_animHeight, 0); _vm->_mult->_animSurf = _vm->_draw->_spritesArray[22]; diff --git a/engines/gob/inter_v3.cpp b/engines/gob/inter_v3.cpp index 000639e784..b66080452a 100644 --- a/engines/gob/inter_v3.cpp +++ b/engines/gob/inter_v3.cpp @@ -894,7 +894,7 @@ bool Inter_v3::o3_copySprite(OpFuncParams ¶ms) { } void Inter_v3::o3_wobble(OpGobParams ¶ms) { - _vm->_draw->wobble(_vm->_draw->_backSurface); + _vm->_draw->wobble(*_vm->_draw->_backSurface); } } // End of namespace Gob diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index 19e813ce1d..a4071d91e2 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -772,9 +772,9 @@ void Inter_v4::o4_initScreen() { memset(_vm->_global->_greenPalette, 0, 256); memset(_vm->_global->_bluePalette, 0, 256); - _vm->_video->_splitSurf = 0; - _vm->_draw->_spritesArray[24] = 0; - _vm->_draw->_spritesArray[25] = 0; + _vm->_video->_splitSurf.reset(); + _vm->_draw->_spritesArray[24].reset(); + _vm->_draw->_spritesArray[25].reset(); _vm->_global->_videoMode = videoMode; _vm->_video->initPrimary(videoMode); @@ -791,8 +791,8 @@ void Inter_v4::o4_initScreen() { _vm->_util->setScrollOffset(); if (offY > 0) { - _vm->_draw->_spritesArray[24] = new SurfaceDesc(videoMode, _vm->_width, offY); - _vm->_draw->_spritesArray[25] = new SurfaceDesc(videoMode, _vm->_width, offY); + _vm->_draw->_spritesArray[24] = SurfaceDescPtr(new SurfaceDesc(videoMode, _vm->_width, offY)); + _vm->_draw->_spritesArray[25] = SurfaceDescPtr(new SurfaceDesc(videoMode, _vm->_width, offY)); _vm->_video->_splitSurf = _vm->_draw->_spritesArray[25]; } } diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp index 488c2052eb..1e0bdfb7a0 100644 --- a/engines/gob/inter_v5.cpp +++ b/engines/gob/inter_v5.cpp @@ -754,9 +754,9 @@ void Inter_v5::o5_initScreen() { memset(_vm->_global->_greenPalette, 0, 256); memset(_vm->_global->_bluePalette, 0, 256); - _vm->_video->_splitSurf = 0; - _vm->_draw->_spritesArray[24] = 0; - _vm->_draw->_spritesArray[25] = 0; + _vm->_video->_splitSurf.reset(); + _vm->_draw->_spritesArray[24].reset(); + _vm->_draw->_spritesArray[25].reset(); _vm->_global->_videoMode = videoMode; _vm->_video->initPrimary(videoMode); @@ -773,8 +773,8 @@ void Inter_v5::o5_initScreen() { _vm->_util->setScrollOffset(); if (offY > 0) { - _vm->_draw->_spritesArray[24] = new SurfaceDesc(videoMode, _vm->_width, offY); - _vm->_draw->_spritesArray[25] = new SurfaceDesc(videoMode, _vm->_width, offY); + _vm->_draw->_spritesArray[24] = SurfaceDescPtr(new SurfaceDesc(videoMode, _vm->_width, offY)); + _vm->_draw->_spritesArray[25] = SurfaceDescPtr(new SurfaceDesc(videoMode, _vm->_width, offY)); _vm->_video->_splitSurf = _vm->_draw->_spritesArray[25]; } } @@ -851,7 +851,7 @@ void Inter_v5::o5_getSystemCDSpeed(OpGobParams ¶ms) { Video::FontDesc *font; if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, _vm->_draw->_backSurface, font); + _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface, font); _vm->_draw->forceBlit(); delete font; @@ -865,7 +865,7 @@ void Inter_v5::o5_getSystemRAM(OpGobParams ¶ms) { Video::FontDesc *font; if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, _vm->_draw->_backSurface, font); + _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface, font); _vm->_draw->forceBlit(); delete font; @@ -879,7 +879,7 @@ void Inter_v5::o5_getSystemCPUSpeed(OpGobParams ¶ms) { Video::FontDesc *font; if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, _vm->_draw->_backSurface, font); + _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface, font); _vm->_draw->forceBlit(); delete font; @@ -893,7 +893,7 @@ void Inter_v5::o5_getSystemDrawSpeed(OpGobParams ¶ms) { Video::FontDesc *font; if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, _vm->_draw->_backSurface, font); + _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface, font); _vm->_draw->forceBlit(); delete font; @@ -907,7 +907,7 @@ void Inter_v5::o5_totalSystemSpecs(OpGobParams ¶ms) { Video::FontDesc *font; if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, _vm->_draw->_backSurface, font); + _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface, font); _vm->_draw->forceBlit(); delete font; diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 04db46c643..e48414ecc0 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -828,13 +828,13 @@ bool Inter_v6::o6_loadCursor(OpFuncParams ¶ms) { int16 width, height; byte *dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height); - _vm->_video->fillRect(_vm->_draw->_cursorSprites, + _vm->_video->fillRect(*_vm->_draw->_cursorSprites, index * _vm->_draw->_cursorWidth, 0, index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1, _vm->_draw->_cursorHeight - 1, 0); _vm->_video->drawPackedSprite(dataBuf, width, height, - index * _vm->_draw->_cursorWidth, 0, 0, _vm->_draw->_cursorSprites); + index * _vm->_draw->_cursorWidth, 0, 0, *_vm->_draw->_cursorSprites); _vm->_draw->_cursorAnimLow[index] = 0; return false; diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 11ef43280f..1670c26ea5 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -85,7 +85,6 @@ Mult::Mult(GobEngine *vm) : _vm(vm) { _palFadingGreen = 0; _palFadingBlue = 0; - _animSurf = 0; _animLeft = 0; _animTop = 0; _animWidth = 0; @@ -111,7 +110,7 @@ Mult::~Mult() { void Mult::initAll(void) { _objects = 0; - _animSurf = 0; + _animSurf.reset(); _renderData = 0; _vm->_scenery->init(); @@ -145,7 +144,7 @@ void Mult::freeMult() { _renderObjs = 0; _orderArray = 0; - _animSurf = 0; + _animSurf.reset(); _vm->_draw->freeSprite(22); } @@ -237,7 +236,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, _animArrayData = 0; _orderArray = 0; - _animSurf = 0; + _animSurf.reset(); _vm->_draw->freeSprite(22); _animDataAllocated = false; diff --git a/engines/gob/mult.h b/engines/gob/mult.h index 3bb3af17b3..7766508922 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -232,7 +232,7 @@ public: int8 *_orderArray; - SurfaceDesc::Ptr _animSurf; + SurfaceDescPtr _animSurf; int16 _animLeft; int16 _animTop; int16 _animWidth; diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp index a369e7d297..e2c16674c9 100644 --- a/engines/gob/mult_v1.cpp +++ b/engines/gob/mult_v1.cpp @@ -234,7 +234,7 @@ void Mult_v1::freeMultKeys() { _animArrayY = 0; _animArrayData = 0; - _animSurf = 0; + _animSurf.reset(); _vm->_draw->freeSprite(22); _animDataAllocated = false; @@ -319,8 +319,8 @@ void Mult_v1::playMultInit() { 320, 200, 0); _vm->_draw->_spritesArray[22] = _animSurf; - _vm->_video->drawSprite(_vm->_draw->_backSurface, - _animSurf, 0, 0, 319, 199, 0, 0, 0); + _vm->_video->drawSprite(*_vm->_draw->_backSurface, + *_animSurf, 0, 0, 319, 199, 0, 0, 0); _animDataAllocated = true; } else @@ -349,7 +349,7 @@ void Mult_v1::drawStatics(bool &stop) { _vm->_scenery->_curStatic = _multData->staticIndices[_vm->_scenery->_curStatic]; _vm->_scenery->renderStatic(_vm->_scenery->_curStatic, _vm->_scenery->_curStaticLayer); - _vm->_video->drawSprite(_vm->_draw->_backSurface, _animSurf, + _vm->_video->drawSprite(*_vm->_draw->_backSurface, *_animSurf, 0, 0, 319, 199, 0, 0, 0); } } diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 1181862039..d9b5be0847 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -565,8 +565,8 @@ void Mult_v2::playMultInit() { _vm->_draw->initSpriteSurf(22, width, height, 0); _animSurf = _vm->_draw->_spritesArray[22]; - _vm->_video->drawSprite(_vm->_draw->_spritesArray[21], - _vm->_draw->_spritesArray[22], 0, 0, + _vm->_video->drawSprite(*_vm->_draw->_spritesArray[21], + *_vm->_draw->_spritesArray[22], 0, 0, _vm->_video->_surfWidth, _vm->_video->_surfHeight, 0, 0, 0); for (_counter = 0; _counter < _objCount; _counter++) @@ -622,8 +622,8 @@ void Mult_v2::drawStatics(bool &stop) { _vm->_scenery->_curStatic = -1; } - _vm->_video->drawSprite(_vm->_draw->_spritesArray[21], - _vm->_draw->_spritesArray[22], 0, 0, + _vm->_video->drawSprite(*_vm->_draw->_spritesArray[21], + *_vm->_draw->_spritesArray[22], 0, 0, _vm->_video->_surfWidth, _vm->_video->_surfHeight, 0, 0, 0); } } diff --git a/engines/gob/save/savefile.cpp b/engines/gob/save/savefile.cpp index b3b545548f..e1c4c62b12 100644 --- a/engines/gob/save/savefile.cpp +++ b/engines/gob/save/savefile.cpp @@ -331,17 +331,14 @@ bool SavePartSprite::readPalette(const byte *palette) { return true; } -bool SavePartSprite::readSprite(const SurfaceDesc *sprite) { - if (!sprite) - return false; - +bool SavePartSprite::readSprite(const SurfaceDesc &sprite) { // The sprite's dimensions have to fit - if (((uint32) sprite->getWidth()) != _width) + if (((uint32)sprite.getWidth()) != _width) return false; - if (((uint32) sprite->getHeight()) != _height) + if (((uint32)sprite.getHeight()) != _height) return false; - memcpy(_dataSprite, sprite->getVidMem(), _width * _height); + memcpy(_dataSprite, sprite.getVidMem(), _width * _height); return true; } @@ -360,17 +357,14 @@ bool SavePartSprite::writePalette(byte *palette) const { return true; } -bool SavePartSprite::writeSprite(SurfaceDesc *sprite) const { - if (!sprite) - return false; - +bool SavePartSprite::writeSprite(SurfaceDesc &sprite) const { // The sprite's dimensions have to fit - if (((uint32) sprite->getWidth()) != _width) + if (((uint32)sprite.getWidth()) != _width) return false; - if (((uint32) sprite->getHeight()) != _height) + if (((uint32)sprite.getHeight()) != _height) return false; - memcpy(sprite->getVidMem(), _dataSprite, _width * _height); + memcpy(sprite.getVidMem(), _dataSprite, _width * _height); return true; } diff --git a/engines/gob/save/savefile.h b/engines/gob/save/savefile.h index 6c211c1d5c..989a37277e 100644 --- a/engines/gob/save/savefile.h +++ b/engines/gob/save/savefile.h @@ -162,7 +162,7 @@ public: /** Read a palette into the part. */ bool readPalette(const byte *palette); /** Read a sprite into the part. */ - bool readSprite(const SurfaceDesc *sprite); + bool readSprite(const SurfaceDesc &sprite); /** Read size bytes of raw data into the sprite. */ bool readSpriteRaw(const byte *data, uint32 size); @@ -170,7 +170,7 @@ public: /** Write a palette out of the part. */ bool writePalette(byte *palette) const; /** Write a sprite out of the part. */ - bool writeSprite(SurfaceDesc *sprite) const; + bool writeSprite(SurfaceDesc &sprite) const; private: uint32 _width; diff --git a/engines/gob/save/savehandler.cpp b/engines/gob/save/savehandler.cpp index 74b878f0a1..4e2c09bdca 100644 --- a/engines/gob/save/savehandler.cpp +++ b/engines/gob/save/savehandler.cpp @@ -242,14 +242,14 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) { if ((index < 0) || (index >= SPRITES_COUNT)) return false; - SurfaceDesc *sprite = _vm->_draw->_spritesArray[index]; + SurfaceDescPtr sprite = _vm->_draw->_spritesArray[index]; // Target sprite exists? if (!sprite) return false; // Load the sprite - if (!_sprite->writeSprite(sprite)) + if (!_sprite->writeSprite(*sprite)) return false; // Handle palette @@ -272,13 +272,13 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) { } bool TempSpriteHandler::save(int16 dataVar, int32 size, int32 offset) { - SurfaceDesc *sprite; + SurfaceDescPtr sprite; if (!createSprite(dataVar, size, offset, &sprite)) return false; // Save the sprite - if (!_sprite->readSprite(sprite)) + if (!_sprite->readSprite(*sprite)) return false; // Handle palette @@ -291,7 +291,7 @@ bool TempSpriteHandler::save(int16 dataVar, int32 size, int32 offset) { } bool TempSpriteHandler::createSprite(int16 dataVar, int32 size, - int32 offset, SurfaceDesc **sprite) { + int32 offset, SurfaceDescPtr *sprite) { delete _sprite; _sprite = 0; @@ -305,7 +305,7 @@ bool TempSpriteHandler::createSprite(int16 dataVar, int32 size, if ((index < 0) || (index >= SPRITES_COUNT)) return false; - SurfaceDesc *sprt = _vm->_draw->_spritesArray[index]; + SurfaceDescPtr sprt = _vm->_draw->_spritesArray[index]; // Sprite exists? if (!sprt) diff --git a/engines/gob/save/savehandler.h b/engines/gob/save/savehandler.h index cb984f7abb..55505d1b9a 100644 --- a/engines/gob/save/savehandler.h +++ b/engines/gob/save/savehandler.h @@ -27,11 +27,11 @@ #define GOB_SAVE_SAVEHANDLER_H #include "common/savefile.h" +#include "engines/gob/video.h" // for SurfaceDescPtr namespace Gob { class GobEngine; -class SurfaceDesc; class SavePartInfo; class SavePartVars; class SavePartSprite; @@ -139,7 +139,7 @@ public: /** Create a fitting sprite. */ bool createSprite(int16 dataVar, int32 size, - int32 offset, SurfaceDesc **sprite = 0); + int32 offset, SurfaceDescPtr *sprite = 0); protected: SavePartSprite *_sprite; diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index 16c6079f45..71750509b4 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -192,7 +192,7 @@ int16 Scenery::loadStatic(char search) { _spriteResId[sprIndex] = sprResId; _vm->_draw->initSpriteSurf(sprIndex, width, height, 2); - _vm->_video->clearSurf(_vm->_draw->_spritesArray[sprIndex]); + _vm->_video->clearSurf(*_vm->_draw->_spritesArray[sprIndex]); _vm->_draw->_destSurface = sprIndex; _vm->_draw->_spriteLeft = sprResId; _vm->_draw->_transparency = 0; @@ -517,7 +517,7 @@ int16 Scenery::loadAnim(char search) { _animPictToSprite[7 * sceneryIndex + i] = sprIndex; _spriteRefs[sprIndex]++; } else { - for (sprIndex = 19; _vm->_draw->_spritesArray[sprIndex] != 0; + for (sprIndex = 19; _vm->_draw->_spritesArray[sprIndex]; sprIndex--) ; @@ -526,7 +526,7 @@ int16 Scenery::loadAnim(char search) { _spriteResId[sprIndex] = sprResId; _vm->_draw->initSpriteSurf(sprIndex, width, height, 2); - _vm->_video->clearSurf(_vm->_draw->_spritesArray[sprIndex]); + _vm->_video->clearSurf(*_vm->_draw->_spritesArray[sprIndex]); _vm->_draw->_destSurface = sprIndex; _vm->_draw->_spriteLeft = sprResId; _vm->_draw->_transparency = 0; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 08aabea004..3b4822cc77 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -96,7 +96,6 @@ Video::Video(GobEngine *vm) : _vm(vm) { _scrollOffsetX = 0; _scrollOffsetY = 0; - _splitSurf = 0; _splitHeight1 = 200; _splitHeight2 = 0; _splitStart = 0; @@ -148,9 +147,8 @@ void Video::initPrimary(int16 mode) { } } -SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height, - int16 flags) { - SurfaceDesc *descPtr = 0; +SurfaceDescPtr Video::initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags) { + SurfaceDescPtr descPtr; if (flags & PRIMARY_SURFACE) assert((width == _surfWidth) && (height == _surfHeight)); @@ -170,7 +168,7 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height, if (!(flags & SCUMMVM_CURSOR)) width = (width + 7) & 0xFFF8; - descPtr = new SurfaceDesc(vidMode, width, height); + descPtr = SurfaceDescPtr(new SurfaceDesc(vidMode, width, height)); } return descPtr; } @@ -241,15 +239,15 @@ void Video::sparseRetrace(int max) { _lastSparse = timeKey; } -void Video::putPixel(int16 x, int16 y, int16 color, SurfaceDesc *dest) { - if ((x >= dest->getWidth()) || (x < 0) || - (y >= dest->getHeight()) || (y < 0)) +void Video::putPixel(int16 x, int16 y, int16 color, SurfaceDesc &dest) { + if ((x >= dest.getWidth()) || (x < 0) || + (y >= dest.getHeight()) || (y < 0)) return; _videoDriver->putPixel(x, y, color, dest); } -void Video::fillRect(SurfaceDesc *dest, int16 left, int16 top, int16 right, +void Video::fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 color) { if (_doRangeClamp) { @@ -258,20 +256,20 @@ void Video::fillRect(SurfaceDesc *dest, int16 left, int16 top, int16 right, if (top > bottom) SWAP(top, bottom); - if ((left >= dest->getWidth()) || (right < 0) || - (top >= dest->getHeight()) || (bottom < 0)) + if ((left >= dest.getWidth()) || (right < 0) || + (top >= dest.getHeight()) || (bottom < 0)) return; - left = CLIP(left, (int16) 0, (int16) (dest->getWidth() - 1)); - top = CLIP(top, (int16) 0, (int16) (dest->getHeight() - 1)); - right = CLIP(right, (int16) 0, (int16) (dest->getWidth() - 1)); - bottom = CLIP(bottom, (int16) 0, (int16) (dest->getHeight() - 1)); + left = CLIP(left, (int16)0, (int16)(dest.getWidth() - 1)); + top = CLIP(top, (int16)0, (int16)(dest.getHeight() - 1)); + right = CLIP(right, (int16)0, (int16)(dest.getWidth() - 1)); + bottom = CLIP(bottom, (int16)0, (int16)(dest.getHeight() - 1)); } _videoDriver->fillRect(dest, left, top, right, bottom, color); } -void Video::drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, +void Video::drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, int16 color) { if ((x0 == x1) || (y0 == y1)) @@ -286,7 +284,7 @@ void Video::drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, * version found in the Wikipedia article about the * "Bresenham's line algorithm" instead */ -void Video::drawCircle(SurfaceDesc *dest, int16 x0, int16 y0, +void Video::drawCircle(SurfaceDesc &dest, int16 x0, int16 y0, int16 radius, int16 color) { int16 f = 1 - radius; int16 ddFx = 0; @@ -319,11 +317,11 @@ void Video::drawCircle(SurfaceDesc *dest, int16 x0, int16 y0, } } -void Video::clearSurf(SurfaceDesc *dest) { - Video::fillRect(dest, 0, 0, dest->getWidth() - 1, dest->getHeight() - 1, 0); +void Video::clearSurf(SurfaceDesc &dest) { + Video::fillRect(dest, 0, 0, dest.getWidth() - 1, dest.getHeight() - 1, 0); } -void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, +void Video::drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) { int16 destRight; int16 destBottom; @@ -334,8 +332,8 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, if (top > bottom) SWAP(top, bottom); - if ((left >= source->getWidth()) || (right < 0) || - (top >= source->getHeight()) || (bottom < 0)) + if ((left >= source.getWidth()) || (right < 0) || + (top >= source.getHeight()) || (bottom < 0)) return; if (left < 0) { @@ -346,12 +344,12 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, y -= top; top = 0; } - right = CLIP(right, (int16) 0, (int16) (source->getWidth() - 1)); - bottom = CLIP(bottom, (int16) 0, (int16) (source->getHeight() - 1)); - if (right - left >= source->getWidth()) - right = left + source->getWidth() - 1; - if (bottom - top >= source->getHeight()) - bottom = top + source->getHeight() - 1; + right = CLIP(right, (int16)0, (int16)(source.getWidth() - 1)); + bottom = CLIP(bottom, (int16)0, (int16)(source.getHeight() - 1)); + if (right - left >= source.getWidth()) + right = left + source.getWidth() - 1; + if (bottom - top >= source.getHeight()) + bottom = top + source.getHeight() - 1; if (x < 0) { left -= x; @@ -361,30 +359,30 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, top -= y; y = 0; } - if ((x >= dest->getWidth()) || (left > right) || - (y >= dest->getHeight()) || (top > bottom)) + if ((x >= dest.getWidth()) || (left > right) || + (y >= dest.getHeight()) || (top > bottom)) return; destRight = x + right - left; destBottom = y + bottom - top; - if (destRight >= dest->getWidth()) - right -= destRight - dest->getWidth() + 1; + if (destRight >= dest.getWidth()) + right -= destRight - dest.getWidth() + 1; - if (destBottom >= dest->getHeight()) - bottom -= destBottom - dest->getHeight() + 1; + if (destBottom >= dest.getHeight()) + bottom -= destBottom - dest.getHeight() + 1; } _videoDriver->drawSprite(source, dest, left, top, right, bottom, x, y, transp); } -void Video::drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, +void Video::drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) { _videoDriver->drawSpriteDouble(source, dest, left, top, right, bottom, x, y, transp); } void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, - int16 color1, int16 color2, int16 transp, SurfaceDesc *dest) { + int16 color1, int16 color2, int16 transp, SurfaceDesc &dest) { byte *dataPtr; byte *itemData; int16 itemSize; @@ -417,25 +415,25 @@ void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, item = 0; } - _videoDriver->drawLetter((unsigned char) item, x, y, fontDesc, color1, color2, transp, dest); + _videoDriver->drawLetter((unsigned char)item, x, y, fontDesc, color1, color2, transp, dest); } void Video::drawPackedSprite(byte *sprBuf, int16 width, int16 height, - int16 x, int16 y, int16 transp, SurfaceDesc *dest) { + int16 x, int16 y, int16 transp, SurfaceDesc &dest) { if (spriteUncompressor(sprBuf, width, height, x, y, transp, dest)) return; - _vm->validateVideoMode(dest->_vidMode); + _vm->validateVideoMode(dest._vidMode); _videoDriver->drawPackedSprite(sprBuf, width, height, x, y, transp, dest); } -void Video::drawPackedSprite(const char *path, SurfaceDesc *dest, int width) { +void Video::drawPackedSprite(const char *path, SurfaceDesc &dest, int width) { byte *data; data = _vm->_dataIO->getData(path); - drawPackedSprite(data, width, dest->getHeight(), 0, 0, 0, dest); + drawPackedSprite(data, width, dest.getHeight(), 0, 0, 0, dest); delete[] data; } diff --git a/engines/gob/video.h b/engines/gob/video.h index 4341d05c14..96ade7ffba 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -28,9 +28,9 @@ #include "common/list.h" #include "common/rect.h" +#include "common/ptr.h" #include "gob/gob.h" -#include "gob/helper.h" namespace Graphics { class PaletteLUT; @@ -39,9 +39,9 @@ namespace Graphics { namespace Gob { // Some Surfaces are simultaneous in Draw::spritesArray and discrete -// variables, so it's a references counting class that cleans -// up its own mess -class SurfaceDesc : public ReferenceCounter { +// variables, so if in doubt you should use a SurfaceDescPtr shared +// pointer object to refer to any SurfaceDesc. +class SurfaceDesc { public: int16 _vidMode; @@ -66,6 +66,9 @@ private: bool _ownVidMem; }; +typedef Common::SharedPtr SurfaceDescPtr; + + class Video { public: struct FontDesc { @@ -117,7 +120,7 @@ public: int16 _scrollOffsetX; int16 _scrollOffsetY; - SurfaceDesc::Ptr _splitSurf; + SurfaceDescPtr _splitSurf; int16 _splitHeight1; int16 _splitHeight2; int16 _splitStart; @@ -129,7 +132,7 @@ public: void freeDriver(); void initPrimary(int16 mode); - SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, + SurfaceDescPtr initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags); void setSize(bool defaultTo1XScaler); @@ -139,24 +142,24 @@ public: void waitRetrace(bool mouse = true); void sparseRetrace(int max); - void putPixel(int16 x, int16 y, int16 color, SurfaceDesc *dest); - virtual void fillRect(SurfaceDesc *dest, int16 left, int16 top, + void putPixel(int16 x, int16 y, int16 color, SurfaceDesc &dest); + virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 color); - void drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, int16 y1, + void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, int16 color); - void drawCircle(SurfaceDesc *dest, int16 x0, int16 y0, + void drawCircle(SurfaceDesc &dest, int16 x0, int16 y0, int16 radius, int16 color); - void clearSurf(SurfaceDesc *dest); - void drawSprite(SurfaceDesc *source, SurfaceDesc *dest, + void clearSurf(SurfaceDesc &dest); + void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); - void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, + void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); void drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, - int16 color1, int16 color2, int16 transp, SurfaceDesc *dest); + int16 color1, int16 color2, int16 transp, SurfaceDesc &dest); void drawPackedSprite(byte *sprBuf, int16 width, int16 height, - int16 x, int16 y, int16 transp, SurfaceDesc *dest); - void drawPackedSprite(const char *path, SurfaceDesc *dest, + int16 x, int16 y, int16 transp, SurfaceDesc &dest); + void drawPackedSprite(const char *path, SurfaceDesc &dest, int width = 320); void setPalColor(byte *pal, byte red, byte green, byte blue) { @@ -181,7 +184,7 @@ public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 x, int16 y, int16 transp, - SurfaceDesc *destDesc) = 0; + SurfaceDesc &destDesc) = 0; virtual void init() {} @@ -210,7 +213,7 @@ protected: class Video_v1 : public Video { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc); + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); Video_v1(GobEngine *vm); virtual ~Video_v1() {} @@ -219,7 +222,7 @@ public: class Video_v2 : public Video_v1 { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc); + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); Video_v2(GobEngine *vm); virtual ~Video_v2() {} @@ -228,9 +231,9 @@ public: class Video_v6 : public Video_v2 { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc); + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); - virtual void fillRect(SurfaceDesc *dest, int16 left, int16 top, + virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 color); virtual void init(); @@ -245,13 +248,13 @@ private: void buildPalLUT(); - void shadeRect(SurfaceDesc *dest, + void shadeRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color, byte strength); - void drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc *surfDesc); - void drawYUVData(const byte *srcData, SurfaceDesc *destDesc, + void drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc &surfDesc); + void drawYUVData(const byte *srcData, SurfaceDesc &destDesc, int16 width, int16 height, int16 x, int16 y); - void drawYUV(SurfaceDesc *destDesc, int16 x, int16 y, + void drawYUV(SurfaceDesc &destDesc, int16 x, int16 y, int16 dataWidth, int16 dataHeight, int16 width, int16 height, const byte *dataY, const byte *dataU, const byte *dataV); }; @@ -260,13 +263,13 @@ class VideoDriver { public: VideoDriver() {} virtual ~VideoDriver() {} - virtual void drawSprite(SurfaceDesc *source, SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; - virtual void drawSpriteDouble(SurfaceDesc *source, SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; - virtual void fillRect(SurfaceDesc *dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0; - virtual void putPixel(int16 x, int16 y, byte color, SurfaceDesc *dest) = 0; - virtual void drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, byte transp, SurfaceDesc *dest) = 0; - virtual void drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) = 0; - virtual void drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, SurfaceDesc *dest) = 0; + virtual void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; + virtual void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; + virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0; + virtual void putPixel(int16 x, int16 y, byte color, SurfaceDesc &dest) = 0; + virtual void drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, byte transp, SurfaceDesc &dest) = 0; + virtual void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) = 0; + virtual void drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, SurfaceDesc &dest) = 0; }; } // End of namespace Gob diff --git a/engines/gob/video_v1.cpp b/engines/gob/video_v1.cpp index 3c9627c041..699ac5f934 100644 --- a/engines/gob/video_v1.cpp +++ b/engines/gob/video_v1.cpp @@ -34,7 +34,7 @@ Video_v1::Video_v1(GobEngine *vm) : Video(vm) { } char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc) { + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc) { byte *memBuffer; byte *srcPtr, *destPtr, *linePtr; byte temp; @@ -46,10 +46,7 @@ char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 bufPos; int16 strLen; - if (!destDesc) - return 1; - - _vm->validateVideoMode(destDesc->_vidMode); + _vm->validateVideoMode(destDesc._vidMode); if (sprBuf[0] != 1) return 0; @@ -59,7 +56,7 @@ char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, if (sprBuf[2] == 2) { SurfaceDesc sourceDesc(0x13, srcWidth, srcHeight, sprBuf + 3); - Video::drawSprite(&sourceDesc, destDesc, 0, 0, srcWidth - 1, + Video::drawSprite(sourceDesc, destDesc, 0, 0, srcWidth - 1, srcHeight - 1, x, y, transp); return 1; } else { @@ -69,7 +66,7 @@ char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, srcPtr = sprBuf + 3; sourceLeft = READ_LE_UINT16(srcPtr); - destPtr = destDesc->getVidMem() + destDesc->getWidth() * y + x; + destPtr = destDesc.getVidMem() + destDesc.getWidth() * y + x; curWidth = 0; curHeight = 0; @@ -96,7 +93,7 @@ char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, curWidth++; if (curWidth >= srcWidth) { curWidth = 0; - linePtr += destDesc->getWidth(); + linePtr += destDesc.getWidth(); destPtr = linePtr; curHeight++; if (curHeight >= srcHeight) @@ -125,7 +122,7 @@ char Video_v1::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, curWidth++; if (curWidth >= srcWidth) { curWidth = 0; - linePtr += destDesc->getWidth(); + linePtr += destDesc.getWidth(); destPtr = linePtr; curHeight++; if (curHeight >= srcHeight) { diff --git a/engines/gob/video_v2.cpp b/engines/gob/video_v2.cpp index ab0c7e52db..b526b63a37 100644 --- a/engines/gob/video_v2.cpp +++ b/engines/gob/video_v2.cpp @@ -34,7 +34,7 @@ Video_v2::Video_v2(GobEngine *vm) : Video_v1(vm) { } char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc) { + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc) { byte *memBuffer; byte *srcPtr, *destPtr, *linePtr; byte temp; @@ -47,10 +47,7 @@ char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 strLen; int16 lenCmd; - if (!destDesc) - return 1; - - _vm->validateVideoMode(destDesc->_vidMode); + _vm->validateVideoMode(destDesc._vidMode); if (sprBuf[0] != 1) return 0; @@ -60,7 +57,7 @@ char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, if (sprBuf[2] == 2) { SurfaceDesc sourceDesc(0x13, srcWidth, srcHeight, sprBuf + 3); - Video::drawSprite(&sourceDesc, destDesc, 0, 0, srcWidth - 1, + Video::drawSprite(sourceDesc, destDesc, 0, 0, srcWidth - 1, srcHeight - 1, x, y, transp); return 1; } else if (sprBuf[2] == 1) { @@ -70,7 +67,7 @@ char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, srcPtr = sprBuf + 3; sourceLeft = READ_LE_UINT32(srcPtr); - destPtr = destDesc->getVidMem() + destDesc->getWidth() * y + x; + destPtr = destDesc.getVidMem() + destDesc.getWidth() * y + x; curWidth = 0; curHeight = 0; @@ -104,7 +101,7 @@ char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, curWidth++; if (curWidth >= srcWidth) { curWidth = 0; - linePtr += destDesc->getWidth(); + linePtr += destDesc.getWidth(); destPtr = linePtr; curHeight++; if (curHeight >= srcHeight) @@ -133,7 +130,7 @@ char Video_v2::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, curWidth++; if (curWidth >= srcWidth) { curWidth = 0; - linePtr += destDesc->getWidth(); + linePtr += destDesc.getWidth(); destPtr = linePtr; curHeight++; if (curHeight >= srcHeight) { diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index c4efadde90..74447f1a84 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -76,11 +76,8 @@ void Video_v6::buildPalLUT() { } char Video_v6::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc *destDesc) { - if (!destDesc) - return 1; - - _vm->validateVideoMode(destDesc->_vidMode); + int16 x, int16 y, int16 transp, SurfaceDesc &destDesc) { + _vm->validateVideoMode(destDesc._vidMode); if ((sprBuf[0] == 1) && (sprBuf[1] == 3)) { drawPacked(sprBuf, x, y, destDesc); @@ -92,7 +89,7 @@ char Video_v6::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, return 1; } -void Video_v6::fillRect(SurfaceDesc *dest, +void Video_v6::fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 color) { if (!(color & 0xFF00)) { @@ -111,27 +108,27 @@ void Video_v6::fillRect(SurfaceDesc *dest, if (top > bottom) SWAP(top, bottom); - if ((left >= dest->getWidth()) || (right < 0) || - (top >= dest->getHeight()) || (bottom < 0)) + if ((left >= dest.getWidth()) || (right < 0) || + (top >= dest.getHeight()) || (bottom < 0)) return; - left = CLIP(left, (int16) 0, (int16) (dest->getWidth() - 1)); - top = CLIP(top, (int16) 0, (int16) (dest->getHeight() - 1)); - right = CLIP(right, (int16) 0, (int16) (dest->getWidth() - 1)); - bottom = CLIP(bottom, (int16) 0, (int16) (dest->getHeight() - 1)); + left = CLIP(left, (int16)0, (int16)(dest.getWidth() - 1)); + top = CLIP(top, (int16)0, (int16)(dest.getHeight() - 1)); + right = CLIP(right, (int16)0, (int16)(dest.getWidth() - 1)); + bottom = CLIP(bottom, (int16)0, (int16)(dest.getHeight() - 1)); } byte strength = 16 - (((uint16) color) >> 12); shadeRect(dest, left, top, right, bottom, color, strength); } -void Video_v6::shadeRect(SurfaceDesc *dest, +void Video_v6::shadeRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color, byte strength) { int width = right - left + 1; int height = bottom - top + 1; - int dWidth = dest->getWidth(); - byte *vidMem = dest->getVidMem() + dWidth * top + left; + int dWidth = dest.getWidth(); + byte *vidMem = dest.getVidMem() + dWidth * top + left; byte sY, sU, sV; _palLUT->getEntry(color, sY, sU, sV); @@ -166,7 +163,7 @@ void Video_v6::shadeRect(SurfaceDesc *dest, delete dither; } -void Video_v6::drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc *surfDesc) { +void Video_v6::drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc &surfDesc) { const byte *data = sprBuf + 2; int16 width = READ_LE_UINT16(data); @@ -192,7 +189,7 @@ void Video_v6::drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc *sur delete[] uncBuf; } -void Video_v6::drawYUVData(const byte *srcData, SurfaceDesc *destDesc, +void Video_v6::drawYUVData(const byte *srcData, SurfaceDesc &destDesc, int16 width, int16 height, int16 x, int16 y) { int16 dataWidth = width; @@ -211,16 +208,16 @@ void Video_v6::drawYUVData(const byte *srcData, SurfaceDesc *destDesc, } -void Video_v6::drawYUV(SurfaceDesc *destDesc, int16 x, int16 y, +void Video_v6::drawYUV(SurfaceDesc &destDesc, int16 x, int16 y, int16 dataWidth, int16 dataHeight, int16 width, int16 height, const byte *dataY, const byte *dataU, const byte *dataV) { - byte *vidMem = destDesc->getVidMem() + y * destDesc->getWidth() + x; + byte *vidMem = destDesc.getVidMem() + y * destDesc.getWidth() + x; - if ((x + width - 1) >= destDesc->getWidth()) - width = destDesc->getWidth() - x; - if ((y + height - 1) >= destDesc->getHeight()) - height = destDesc->getHeight() - y; + if ((x + width - 1) >= destDesc.getWidth()) + width = destDesc.getWidth() - x; + if ((y + height - 1) >= destDesc.getHeight()) + height = destDesc.getHeight() - y; Graphics::SierraLight *dither = new Graphics::SierraLight(width, _palLUT); @@ -240,7 +237,7 @@ void Video_v6::drawYUV(SurfaceDesc *destDesc, int16 x, int16 y, } dither->nextLine(); - vidMem += destDesc->getWidth(); + vidMem += destDesc.getWidth(); } delete dither; diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 21cec36231..fccda1a859 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -256,7 +256,7 @@ bool VideoPlayer::primaryOpen(const char *videoFile, int16 x, int16 y, _ownSurf = false; if (!(flags & kFlagNoVideo)) { - SurfaceDesc::Ptr surf; + SurfaceDescPtr surf; if (flags & kFlagOtherSurface) { _ownSurf = true; -- cgit v1.2.3