From 591973c827c60648b6d94e2bca44fd1df49ed2f5 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Thu, 31 Jul 2008 12:26:12 +0000 Subject: Changed Gfx::_backgroundInfo to be a pointer. This temporarily kills all z-buffering. svn-id: r33468 --- engines/parallaction/graphics.cpp | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'engines/parallaction/graphics.cpp') diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index a31b7f4994..7aa284e82c 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -269,7 +269,7 @@ void Gfx::animatePalette() { PaletteFxRange *range; for (uint16 i = 0; i < 4; i++) { - range = &_backgroundInfo.ranges[i]; + range = &_backgroundInfo->ranges[i]; if ((range->_flags & 1) == 0) continue; // animated palette range->_timer += range->_step * 2; // update timer @@ -359,7 +359,7 @@ void Gfx::clearScreen() { } void Gfx::beginFrame() { - _skipBackground = (_backgroundInfo.bg.pixels == 0); // don't render frame if background is missing + _skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing if (!_skipBackground) { int32 oldBackgroundMode = _varBackgroundMode; @@ -370,11 +370,11 @@ void Gfx::beginFrame() { _bitmapMask.free(); break; case 2: - _bitmapMask.create(_backgroundInfo.width, _backgroundInfo.height, 1); + _bitmapMask.create(_backgroundInfo->width, _backgroundInfo->height, 1); byte *data = (byte*)_bitmapMask.pixels; for (uint y = 0; y < _bitmapMask.h; y++) { for (uint x = 0; x < _bitmapMask.w; x++) { - *data++ = _backgroundInfo.mask.getValue(x, y); + *data++ = _backgroundInfo->mask.getValue(x, y); } } break; @@ -389,7 +389,7 @@ void Gfx::beginFrame() { warning("Path zones are supported only in Big Red Adventure"); } - if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo.width)) { + if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo->width)) { _varScrollX = 0; } else { _varScrollX = getVar("scroll_x"); @@ -416,22 +416,22 @@ void Gfx::updateScreen() { if (!_skipBackground) { // background may not cover the whole screen, so adjust bulk update size - uint w = MIN(_vm->_screenWidth, (int32)_backgroundInfo.width); - uint h = MIN(_vm->_screenHeight, (int32)_backgroundInfo.height); + uint w = MIN(_vm->_screenWidth, (int32)_backgroundInfo->width); + uint h = MIN(_vm->_screenHeight, (int32)_backgroundInfo->height); byte *backgroundData = 0; uint16 backgroundPitch = 0; switch (_varBackgroundMode) { case 1: - backgroundData = (byte*)_backgroundInfo.bg.getBasePtr(_varScrollX, 0); - backgroundPitch = _backgroundInfo.bg.pitch; + backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(_varScrollX, 0); + backgroundPitch = _backgroundInfo->bg.pitch; break; case 2: backgroundData = (byte*)_bitmapMask.getBasePtr(_varScrollX, 0); backgroundPitch = _bitmapMask.pitch; break; } - g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo.x, _backgroundInfo.y, w, h); + g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->x, _backgroundInfo->y, w, h); } if (_varDrawPathZones == 1) { @@ -499,17 +499,17 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) Common::Rect r(surf.w, surf.h); r.moveTo(x, y); - uint16 z = (mask) ? _backgroundInfo.getLayer(y) : LAYER_FOREGROUND; - blt(r, (byte*)surf.pixels, &_backgroundInfo.bg, z, 0); + uint16 z = (mask) ? _backgroundInfo->getLayer(y) : LAYER_FOREGROUND; + blt(r, (byte*)surf.pixels, &_backgroundInfo->bg, z, 0); } void Gfx::fillBackground(const Common::Rect& r, byte color) { - _backgroundInfo.bg.fillRect(r, color); + _backgroundInfo->bg.fillRect(r, color); } void Gfx::invertBackground(const Common::Rect& r) { - byte *d = (byte*)_backgroundInfo.bg.getBasePtr(r.left, r.top); + byte *d = (byte*)_backgroundInfo->bg.getBasePtr(r.left, r.top); for (int i = 0; i < r.height(); i++) { for (int j = 0; j < r.width(); j++) { @@ -517,7 +517,7 @@ void Gfx::invertBackground(const Common::Rect& r) { d++; } - d += (_backgroundInfo.bg.pitch - r.width()); + d += (_backgroundInfo->bg.pitch - r.width()); } } @@ -724,7 +724,7 @@ void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surf } void Gfx::grabBackground(const Common::Rect& r, Graphics::Surface &dst) { - copyRect(r, _backgroundInfo.bg, dst); + copyRect(r, _backgroundInfo->bg, dst); } @@ -744,6 +744,8 @@ Gfx::Gfx(Parallaction* vm) : _screenX = 0; _screenY = 0; + _backgroundInfo = 0; + _halfbrite = false; _hbCircleRadius = 0; @@ -766,7 +768,6 @@ Gfx::Gfx(Parallaction* vm) : BackgroundInfo paletteInfo; _disk->loadSlide(paletteInfo, "pointer"); _backupPal.clone(paletteInfo.palette); - paletteInfo.free(); } return; @@ -774,7 +775,8 @@ Gfx::Gfx(Parallaction* vm) : Gfx::~Gfx() { - freeBackground(); + delete _backgroundInfo; + freeLabels(); delete []_unpackedBitmap; @@ -829,16 +831,14 @@ void Gfx::freeItems() { _numItems = 0; } -void Gfx::freeBackground() { - _backgroundInfo.free(); -} void Gfx::setBackground(uint type, const char* name, const char* mask, const char* path) { - freeBackground(); + delete _backgroundInfo; + _backgroundInfo = new BackgroundInfo; if (type == kBackgroundLocation) { - _disk->loadScenery(_backgroundInfo, name, mask, path); + _disk->loadScenery(*_backgroundInfo, name, mask, path); // The PC version of BRA needs the entries 20-31 of the palette to be constant, but // the background resource files are screwed up. The right colors come from an unused @@ -847,17 +847,17 @@ void Gfx::setBackground(uint type, const char* name, const char* mask, const cha int r, g, b; for (uint i = 16; i < 32; i++) { _backupPal.getEntry(i, r, g, b); - _backgroundInfo.palette.setEntry(i, r, g, b); + _backgroundInfo->palette.setEntry(i, r, g, b); } } - setPalette(_backgroundInfo.palette); - _palette.clone(_backgroundInfo.palette); + setPalette(_backgroundInfo->palette); + _palette.clone(_backgroundInfo->palette); } else { - _disk->loadSlide(_backgroundInfo, name); + _disk->loadSlide(*_backgroundInfo, name); for (uint i = 0; i < 6; i++) - _backgroundInfo.ranges[i]._flags = 0; // disable palette cycling for slides - setPalette(_backgroundInfo.palette); + _backgroundInfo->ranges[i]._flags = 0; // disable palette cycling for slides + setPalette(_backgroundInfo->palette); } } -- cgit v1.2.3