diff options
Diffstat (limited to 'engines/hopkins/graphics.cpp')
-rw-r--r-- | engines/hopkins/graphics.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ebc5cfa8da..7227c3e833 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -28,7 +28,7 @@ #include "common/system.h" #include "graphics/palette.h" -#include "graphics/decoders/pcx.h" +#include "image/pcx.h" #include "common/file.h" #include "common/rect.h" #include "engines/util.h" @@ -301,7 +301,7 @@ void GraphicsManager::fillSurface(byte *surface, byte *col, int size) { void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; - Graphics::PCXDecoder pcxDecoder; + Image::PCXDecoder pcxDecoder; // Clear the passed surface memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); @@ -325,7 +325,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte // Copy out the dimensions and pixels of the decoded surface _largeScreenFl = s->w > SCREEN_WIDTH; - Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); + Common::copy((const byte *)s->getPixels(), (const byte *)s->getBasePtr(0, s->h), surface); // Copy out the palette const byte *palSrc = pcxDecoder.getPalette(); @@ -439,9 +439,7 @@ void GraphicsManager::display8BitRect(const byte *surface, int xs, int ys, int w } void GraphicsManager::displayScaled8BitRect(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - int xCtr; const byte *palette; - int savedXCount; byte *loopDestP; const byte *loopSrcP; int yCtr; @@ -454,10 +452,10 @@ void GraphicsManager::displayScaled8BitRect(const byte *surface, int xp, int yp, do { yCtr = yCount; - xCtr = xCount; + int xCtr = xCount; loopSrcP = srcP; loopDestP = destP; - savedXCount = xCount; + int savedXCount = xCount; palette = _palettePixels; do { @@ -1179,7 +1177,7 @@ void GraphicsManager::displayZones() { Common::Rect r(_vm->_objectsMan->_bob[bobId]._oldX, _vm->_objectsMan->_bob[bobId]._oldY, _vm->_objectsMan->_bob[bobId]._oldX + _vm->_objectsMan->_bob[bobId]._oldWidth, _vm->_objectsMan->_bob[bobId]._oldY + _vm->_objectsMan->_bob[bobId]._oldHeight); - + displayDebugRect(screenSurface, r, 0xff0000); } } @@ -1202,15 +1200,13 @@ void GraphicsManager::displayZones() { void GraphicsManager::displayLines() { Graphics::Surface *screenSurface = g_system->lockScreen(); - uint16* pixels = (uint16*)screenSurface->pixels; - - for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { + for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { int i = 0; do { int x = _vm->_linesMan->_lineItem[lineIndex]._lineData[i] - _scrollPosX; int y = _vm->_linesMan->_lineItem[lineIndex]._lineData[i+1]; if (x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT) { - pixels[ y * screenSurface->w + x ] = 0xffff; + WRITE_UINT16(screenSurface->getBasePtr(x, y), 0xffff); } i += 2; } @@ -1230,7 +1226,7 @@ void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common: r.top = MAX(r.top, (int16)0); r.right = MIN(r.right, (int16)SCREEN_WIDTH); r.bottom = MIN(r.bottom, (int16)SCREEN_HEIGHT); - + // If there's an on-screen portion, display it if (r.isValidRect()) surface->frameRect(r, color); @@ -1361,7 +1357,7 @@ void GraphicsManager::drawCompressedSprite(byte *surface, const byte *srcData, i _posYClipped = 0; _clipX1 = 0; _clipY1 = 0; - if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300)) + if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300)) return; // Clipped values are greater or equal to zero, thanks to the previous test @@ -1783,7 +1779,7 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init do { int dataVal1 = _vm->_script->handleOpcode(ptr + 20 * dataOffset); - if (_vm->shouldQuit()) + if (dataVal1 == -1 || _vm->shouldQuit()) return; if (dataVal1 == 2) |