aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2014-06-17 15:24:42 +0300
committerEugene Sandulenko2014-06-17 15:24:42 +0300
commit6c8d48c5a533eac4494c231b9f488080e09e15b3 (patch)
tree62452cd1d78461e06b0847af3e69c5467e81cc10 /engines
parent7c444319cbb14b95a5fe2c7cf2c5471ab065c961 (diff)
downloadscummvm-rg350-6c8d48c5a533eac4494c231b9f488080e09e15b3.tar.gz
scummvm-rg350-6c8d48c5a533eac4494c231b9f488080e09e15b3.tar.bz2
scummvm-rg350-6c8d48c5a533eac4494c231b9f488080e09e15b3.zip
FULLPIPE: Cleanup gfx code
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/gfx.cpp43
-rw-r--r--engines/fullpipe/gfx.h3
-rw-r--r--engines/fullpipe/statics.cpp16
3 files changed, 15 insertions, 47 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 718a3a32c5..2bed8a8195 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -469,7 +469,7 @@ void Picture::freePicture() {
if (_bitmap) {
if (testFlags() && !_field_54) {
freeData();
- free(_bitmap);
+ //free(_bitmap);
_bitmap = 0;
}
}
@@ -590,6 +590,8 @@ void Picture::getDibInfo() {
_bitmap->_pixels = _data;
_bitmap->decode((int32 *)(_paletteData ? _paletteData : g_fp->_globalPalette));
+
+ _bitmap->_pixels = 0;
}
Bitmap *Picture::getPixelData() {
@@ -801,33 +803,6 @@ bool Bitmap::isPixelHitAtPos(int x, int y) {
if (x < _x || x >= _width + _x || y < _y || y >= _y + _height)
return false;
- int off;
-
- if (_type == 'CB\x05e')
- off = 2 * ((_width + 1) / 2);
- else
- off = 4 * ((_width + 3) / 4);
-
- off = x + off * (_y + _height - y - 1) - _x;
-
- if (_flags & 0x1000000) {
- switch (_type) {
- case 'CB\0\0':
- if (_pixels[off] == (_flags & 0xff))
- return false;
- break;
- case 'CB\x05e':
- if (!*(int16 *)&_pixels[2 * off])
- return false;
- break;
- case 'RB\0\0':
- return isPixelAtHitPosRB(x, y);
- }
- }
- return true;
-}
-
-bool Bitmap::isPixelAtHitPosRB(int x, int y) {
if (!_surface)
return false;
@@ -1146,13 +1121,13 @@ void Bitmap::copier(uint32 *dest, byte *src, int len, int32 *palette, bool cb05_
}
}
-Bitmap *Bitmap::reverseImage() {
- Bitmap *res = new Bitmap(this);
-
- res->_flipping = Graphics::FLIP_H;
- res->_pixels = 0;
+Bitmap *Bitmap::reverseImage(bool flip) {
+ if (flip)
+ _flipping = Graphics::FLIP_H;
+ else
+ _flipping = Graphics::FLIP_NONE;
- return res;
+ return this;
}
Bitmap *Bitmap::flipVertical() {
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 576ff7ee39..d4d70fc34b 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -56,14 +56,13 @@ struct Bitmap {
void copierKeyColor(uint32 *dest, byte *src, int len, int keyColor, int32 *palette, bool cb05_format);
void copier(uint32 *dest, byte *src, int len, int32 *palette, bool cb05_format);
- Bitmap *reverseImage();
+ Bitmap *reverseImage(bool flip = true);
Bitmap *flipVertical();
void drawShaded(int type, int x, int y, byte *palette);
void drawRotated(int x, int y, int angle, byte *palette);
bool isPixelHitAtPos(int x, int y);
- bool isPixelAtHitPosRB(int x, int y);
};
class Picture : public MemoryObject {
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 292ef08914..f757a5122e 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -528,7 +528,7 @@ void Movement::draw(bool flipFlag, int angle) {
if (_currMovement) {
bmp = _currDynamicPhase->getPixelData()->reverseImage();
} else {
- bmp = _currDynamicPhase->getPixelData();
+ bmp = _currDynamicPhase->getPixelData()->reverseImage(false);
}
if (flipFlag) {
@@ -553,7 +553,7 @@ void Movement::draw(bool flipFlag, int angle) {
//vrtSetAlphaBlendMode(g_vrtDrawHandle, 0, 255);
} else {
//vrtSetAlphaBlendMode(g_vrtDrawHandle, 1, LOBYTE(_currDynamicPhase->rect.top));
- _currDynamicPhase->_convertedBitmap->putDib(x, y, (int32 *)_currDynamicPhase->_paletteData);
+ _currDynamicPhase->_convertedBitmap->reverseImage(false)->putDib(x, y, (int32 *)_currDynamicPhase->_paletteData);
//vrtSetAlphaBlendMode(g_vrtDrawHandle, 0, 255);
}
}
@@ -1454,14 +1454,8 @@ bool Statics::load(MfcArchive &file) {
void Statics::init() {
Picture::init();
- if (_staticsId & 0x4000) {
- Bitmap *bmp = _bitmap->reverseImage();
-
- freePixelData();
-
- _bitmap = bmp;
- _data = bmp->_pixels;
- }
+ if (_staticsId & 0x4000)
+ _bitmap->reverseImage();
}
Common::Point *Statics::getSomeXY(Common::Point &p) {
@@ -2211,7 +2205,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) {
_mfield_10 = src->_mfield_10;
_libHandle = src->_libHandle;
- _bitmap = src->_bitmap;
+ _bitmap = src->_bitmap->reverseImage(false);
if (_bitmap)
_field_54 = 1;