aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-06-15 21:33:41 +0200
committeruruk2014-06-15 21:33:41 +0200
commit9023240545bdadd0ccea93dddae30d1e13f5b107 (patch)
tree58ed849b9cc2776c63b62d30e1720f6ec8b89b82
parentc488c15289d9a5c21fc6bad54c9614f54dd8b3bf (diff)
downloadscummvm-rg350-9023240545bdadd0ccea93dddae30d1e13f5b107.tar.gz
scummvm-rg350-9023240545bdadd0ccea93dddae30d1e13f5b107.tar.bz2
scummvm-rg350-9023240545bdadd0ccea93dddae30d1e13f5b107.zip
CGE2: Rework show() and hide() in Bitmap to use V2Ds as parameters.
-rw-r--r--engines/cge2/bitmap.h4
-rw-r--r--engines/cge2/snail.cpp2
-rw-r--r--engines/cge2/vga13h.cpp25
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);
}