diff options
author | Filippos Karapetis | 2019-12-28 13:21:23 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-12-28 13:22:18 +0200 |
commit | 0ae3cbc2e8dca79ee75f235469ed26715efb0ace (patch) | |
tree | 4cc9cde49f83366d3486ee2d7deb3160c9ba7221 /engines/startrek/rooms | |
parent | 9cbedc03f9b9e9e44abc457e60ade4b9d14f8938 (diff) | |
download | scummvm-rg350-0ae3cbc2e8dca79ee75f235469ed26715efb0ace.tar.gz scummvm-rg350-0ae3cbc2e8dca79ee75f235469ed26715efb0ace.tar.bz2 scummvm-rg350-0ae3cbc2e8dca79ee75f235469ed26715efb0ace.zip |
STARTREK: Reduce usage of SharedPtr, and simplify bitmap related calls
Diffstat (limited to 'engines/startrek/rooms')
-rw-r--r-- | engines/startrek/rooms/demon4.cpp | 24 | ||||
-rw-r--r-- | engines/startrek/rooms/demon6.cpp | 7 |
2 files changed, 17 insertions, 14 deletions
diff --git a/engines/startrek/rooms/demon4.cpp b/engines/startrek/rooms/demon4.cpp index 46ae5c8f4c..0028ad7a18 100644 --- a/engines/startrek/rooms/demon4.cpp +++ b/engines/startrek/rooms/demon4.cpp @@ -393,25 +393,25 @@ bool Room::demon4ShowSunPuzzle() { _vm->_gfx->addSprite(&sprites[i]); } - sprites[0].setBitmap(_vm->_gfx->loadBitmap("levery")); - sprites[1].setBitmap(_vm->_gfx->loadBitmap("leverr")); - sprites[2].setBitmap(_vm->_gfx->loadBitmap("leverb")); + sprites[0].setBitmap(_vm->loadBitmapFile("levery")); + sprites[1].setBitmap(_vm->loadBitmapFile("leverr")); + sprites[2].setBitmap(_vm->loadBitmapFile("leverb")); - SharedPtr<Bitmap> lightyBitmap = SharedPtr<Bitmap>(_vm->_gfx->loadBitmap("lighty")); - SharedPtr<Bitmap> lightrBitmap = SharedPtr<Bitmap>(_vm->_gfx->loadBitmap("lightr")); - SharedPtr<Bitmap> lightbBitmap = SharedPtr<Bitmap>(_vm->_gfx->loadBitmap("lightb")); + Bitmap *lightyBitmap = new Bitmap(_vm->loadBitmapFile("lighty")); + Bitmap *lightrBitmap = new Bitmap(_vm->loadBitmapFile("lightr")); + Bitmap *lightbBitmap = new Bitmap(_vm->loadBitmapFile("lightb")); for (int i = 3; i < 9; i++) - sprites[i].bitmap = lightyBitmap; + sprites[i].setBitmap(lightyBitmap); for (int i = 9; i < 15; i++) - sprites[i].bitmap = lightrBitmap; + sprites[i].setBitmap(lightrBitmap); for (int i = 15; i < 21; i++) - sprites[i].bitmap = lightbBitmap; + sprites[i].setBitmap(lightbBitmap); Sprite doneButtonSprite; _vm->_gfx->addSprite(&doneButtonSprite); doneButtonSprite.setXYAndPriority(0x104, 0x64, 2); - doneButtonSprite.setBitmap(_vm->_gfx->loadBitmap("donebutt")); + doneButtonSprite.setBitmap(_vm->loadBitmapFile("donebutt")); // BUGFIX: use draw mode 2 so the entire button is clickable (not just non-transparent // pixels) doneButtonSprite.drawMode = 2; @@ -532,6 +532,10 @@ done: _vm->_gfx->copyBackgroundScreen(); _vm->_gfx->forceDrawAllSprites(); + delete lightbBitmap; + delete lightrBitmap; + delete lightyBitmap; + return solved; } diff --git a/engines/startrek/rooms/demon6.cpp b/engines/startrek/rooms/demon6.cpp index 38e274ef41..038f66dea8 100644 --- a/engines/startrek/rooms/demon6.cpp +++ b/engines/startrek/rooms/demon6.cpp @@ -466,7 +466,7 @@ int Room::demon6ShowCase(int visible) { sprites[i].pos.y = spritePositions[i].y; sprites[i].drawPriority = 2; sprites[i].bitmapChanged = true; - sprites[i].setBitmap(_vm->_gfx->loadBitmap(Common::String::format("stlitem%d", i))); + sprites[i].setBitmap(_vm->loadBitmapFile(Common::String::format("stlitem%d", i))); } Sprite buttonSprite; @@ -478,7 +478,7 @@ int Room::demon6ShowCase(int visible) { buttonSprite.pos.y = 0x19; buttonSprite.drawPriority = 2; buttonSprite.bitmapChanged = true; - buttonSprite.setBitmap(_vm->_gfx->loadBitmap("donebutt")); + buttonSprite.setBitmap(_vm->loadBitmapFile("donebutt")); _vm->_gfx->addSprite(&buttonSprite); _vm->_gfx->forceDrawAllSprites(); @@ -579,8 +579,7 @@ int Room::demon6ShowCaseProcessSelection(Sprite *sprites, Sprite *clickedSprite, _vm->_gfx->drawAllSprites(); _vm->_gfx->delSprite(clickedSprite); clickedSprite->bitmap.reset(); - int i = clickedSprite - sprites; - visible ^= (0x10 >> i); + visible ^= (0x10 >> (clickedSprite - sprites)); return visible; } |