From 6d1e4dd0344f9baef12709e2c90ac98e17392786 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 7 Dec 2009 18:20:20 +0000 Subject: M4: Rename M4Surface::getData() to getBasePtr() for consistency svn-id: r46279 --- engines/m4/assets.cpp | 2 +- engines/m4/events.cpp | 2 +- engines/m4/graphics.cpp | 16 ++++------------ engines/m4/graphics.h | 11 +++++++++-- engines/m4/sprite.cpp | 8 ++++---- 5 files changed, 19 insertions(+), 20 deletions(-) (limited to 'engines') diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 1dbf9e79c7..746cc7507d 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -158,7 +158,7 @@ void SpriteAsset::loadM4SpriteAsset(M4Engine *vm, Common::SeekableReadStream* st char fn[512]; sprintf(fn, "%04d.raw", curFrame); FILE *h = fopen(fn, "wb"); - fwrite((byte*)frame.frame->getData(), frame.w * frame.h, 1, h); + fwrite((byte*)frame.frame->getBasePtr(), frame.w * frame.h, 1, h); fclose(h); #endif } diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp index 5c9313cbfb..8ac8346838 100644 --- a/engines/m4/events.cpp +++ b/engines/m4/events.cpp @@ -240,7 +240,7 @@ bool Mouse::setCursorNum(int cursorIndex) { _cursor = _cursorSprites->getFrame(cursorIndex); // Set the cursor to the sprite - CursorMan.replaceCursor((const byte *)_cursor->getData(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0); + CursorMan.replaceCursor((const byte *)_cursor->getBasePtr(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0); return true; } diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 06bb358179..b3c1a8cf04 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -216,7 +216,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c return; int heightAmt = scaledHeight; - byte *src = info.sprite->getData(); + byte *src = info.sprite->getBasePtr(); byte *dst = getBasePtr(x - info.hotX - clipX, y - info.hotY - clipY); int status = kStatusSkip; @@ -309,19 +309,11 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c // Surface methods -byte *M4Surface::getData() { - return (byte *)pixels; -} - -byte *M4Surface::getBasePtr(int x, int y) { - return (byte *)Graphics::Surface::getBasePtr(x, y); -} - void M4Surface::freeData() { } void M4Surface::clear() { - Common::set_to((byte *) pixels, (byte *) pixels + w * h, _vm->_palette->BLACK); + Common::set_to((byte *)pixels, (byte *)pixels + w * h, _vm->_palette->BLACK); } void M4Surface::frameRect(const Common::Rect &r, uint8 color) { @@ -357,7 +349,7 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest // Copy the specified area - byte *data = src->getData(); + byte *data = src->getBasePtr(); byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left); byte *destPtr = (byte *)pixels + (destY * width()) + destX; @@ -855,7 +847,7 @@ void Palette::fadeToGreen(int numSteps, uint delayAmount) { // Remap all pixels into the #32-63 range - tempP = _vm->_scene->getData(); + tempP = _vm->_scene->getBasePtr(); for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height(); ++pixelCtr, ++tempP) { // If pixel is in #32-63 range already, remap to higher palette entries diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h index c210caef1e..0fc448dad1 100644 --- a/engines/m4/graphics.h +++ b/engines/m4/graphics.h @@ -125,8 +125,15 @@ public: int width() { return w; } int height() { return h; } void setSize(int sizeX, int sizeY) { create(sizeX, sizeY, 1); } - byte *getData(); - byte *getBasePtr(int x, int y); + inline byte *getBasePtr() { + return (byte *)pixels; + } + inline byte *getBasePtr(int x, int y) { + return (byte *)Graphics::Surface::getBasePtr(x, y); + } + inline const byte *getBasePtr(int x, int y) const { + return (const byte *)Graphics::Surface::getBasePtr(x, y); + } void freeData(); void clear(); void frameRect(const Common::Rect &r, uint8 color); diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp index 6c7911b2e9..d3299ff699 100644 --- a/engines/m4/sprite.cpp +++ b/engines/m4/sprite.cpp @@ -47,7 +47,7 @@ M4Sprite::M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int w loadRle(source); } else { // Raw sprite data, load directly - byte *dst = getData(); + byte *dst = getBasePtr(); source->read(dst, widthVal * heightVal); } } else { @@ -60,7 +60,7 @@ M4Sprite::M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int w } void M4Sprite::loadRle(Common::SeekableReadStream* rleData) { - byte *dst = getData(); + byte *dst = getBasePtr(); while (1) { byte len = rleData->readByte(); if (len == 0) { @@ -124,8 +124,8 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) { byte *outp, *lineStart; bool newLine = false; - outp = getData(); - lineStart = getData(); + outp = getBasePtr(); + lineStart = getBasePtr(); while (1) { byte cmd1, cmd2, count, pixel; -- cgit v1.2.3