From 9023240545bdadd0ccea93dddae30d1e13f5b107 Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 15 Jun 2014 21:33:41 +0200 Subject: CGE2: Rework show() and hide() in Bitmap to use V2Ds as parameters. --- engines/cge2/bitmap.h | 4 ++-- engines/cge2/snail.cpp | 2 +- engines/cge2/vga13h.cpp | 25 ++++++++++--------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/engines/cge2/bitmap.h b/engines/cge2/bitmap.h index 2c7b31b110..e7a4637b87 100644 --- a/engines/cge2/bitmap.h +++ b/engines/cge2/bitmap.h @@ -81,8 +81,8 @@ public: Bitmap *code(uint8 *map); Bitmap &operator=(const Bitmap &bmp); void release(); - void hide(int16 x, int16 y); - void show(int16 x, int16 y); + void hide(V2D pos); + void show(V2D pos); bool solidAt(V2D pos); void xLatPos(V2D& p); bool moveHi(); diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp index 5e417a1b8c..068ccf86d5 100644 --- a/engines/cge2/snail.cpp +++ b/engines/cge2/snail.cpp @@ -604,7 +604,7 @@ void CGE2Engine::snDim(Sprite *spr, int val) { void CGE2Engine::snGhost(Bitmap *bmp) { V2D p(this, bmp->_map & 0xFFFF, bmp->_map >> 16); - bmp->hide(p.x, p.y); + bmp->hide(p); delete[] bmp->_b; bmp->_v = nullptr; bmp->_b = nullptr; diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 48c0b1be11..24376d91bb 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -610,20 +610,20 @@ void Sprite::show() { e->_b1 = getShp(); } if (!_flags._hide) - e->_b1->show(e->_p1.x, e->_p1.y); + e->_b1->show(e->_p1); } void Sprite::show(uint16 pg) { Graphics::Surface *a = _vm->_vga->_page[1]; _vm->_vga->_page[1] = _vm->_vga->_page[pg]; - getShp()->show(_pos2D.x, _pos2D.y); + getShp()->show(_pos2D); _vm->_vga->_page[1] = a; } void Sprite::hide() { SprExt *e = _ext; if (e->_b0) - e->_b0->hide(e->_p0.x, e->_p0.y); + e->_b0->hide(e->_p0); } BitmapPtr Sprite::ghost() { @@ -1059,11 +1059,8 @@ void Vga::copyPage(uint16 d, uint16 s) { _page[d]->copyFrom(*_page[s]); } -void Bitmap::show(int16 x, int16 y) { - V2D pos(_vm, x, y); +void Bitmap::show(V2D pos) { xLatPos(pos); - x = pos.x; - y = pos.y; const byte *srcP = (const byte *)_v; byte *screenStartP = (byte *)_vm->_vga->_page[1]->getPixels(); @@ -1073,7 +1070,7 @@ void Bitmap::show(int16 x, int16 y) { // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data // must be decompressed and inserted into the surface for (int planeCtr = 0; planeCtr < 4; planeCtr++) { - byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(x + planeCtr, y); + byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(pos.x + planeCtr, pos.y); for (;;) { uint16 v = READ_LE_UINT16(srcP); @@ -1117,15 +1114,13 @@ void Bitmap::show(int16 x, int16 y) { } -void Bitmap::hide(int16 x, int16 y) { - V2D pos(_vm, x, y); +void Bitmap::hide(V2D pos) { xLatPos(pos); - x = pos.x; - y = pos.y; - for (int yp = y; yp < y + _h; yp++) { + + for (int yp = pos.y; yp < pos.y + _h; yp++) { if (yp >= 0 && yp < kScrHeight) { - const byte *srcP = (const byte *)_vm->_vga->_page[2]->getBasePtr(x, yp); - byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(x, yp); + const byte *srcP = (const byte *)_vm->_vga->_page[2]->getBasePtr(pos.x, yp); + byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(pos.x, yp); Common::copy(srcP, srcP + _w, destP); } -- cgit v1.2.3