mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
GRIM: Hide the zbuffer bitmap if it doesn't have the wanted image. Fix #296
This commit is contained in:
@@ -296,6 +296,14 @@ void Bitmap::draw() const {
|
||||
g_driver->drawBitmap(this);
|
||||
}
|
||||
|
||||
void Bitmap::setNumber(int n) {
|
||||
if ((n - 1) >= _data->_numImages) {
|
||||
warning("Bitmap::setNumber: no anim image: %d. (%s)", n, _data->_fname.c_str());
|
||||
} else {
|
||||
_currImage = n;
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap::~Bitmap() {
|
||||
--_data->_refCount;
|
||||
if (_data->_refCount < 1) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
void draw() const;
|
||||
|
||||
// Set which image in an animated bitmap to use
|
||||
void setNumber(int n) { if ((n - 1) >= _data->_numImages) warning("Bitmap::setNumber: no anim image: %d", n); else _currImage = n; }
|
||||
void setNumber(int n);
|
||||
|
||||
int getNumImages() const { return _data->_numImages; }
|
||||
int getCurrentImage() const { return _currImage; }
|
||||
|
||||
@@ -63,8 +63,13 @@ void ObjectState::setNumber(int val) {
|
||||
if (val) {
|
||||
assert(_bitmap);
|
||||
_bitmap->setNumber(val);
|
||||
if (_zbitmap)
|
||||
_zbitmap->setNumber(val);
|
||||
if (_zbitmap) {
|
||||
if (val > _zbitmap->getNumImages()) {
|
||||
_zbitmap->setNumber(0);
|
||||
} else {
|
||||
_zbitmap->setNumber(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_visibility = val != 0;
|
||||
|
||||
Reference in New Issue
Block a user