ALL: fix a bunch of const warnings
Also while add it, constify some code
This commit is contained in:
parent
10e934ffa7
commit
08b4639cbb
6 changed files with 23 additions and 23 deletions
|
@ -147,7 +147,7 @@ bool OSystem_MacOSX::setTextInClipboard(const Common::String &text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSystem_MacOSX::openUrl(const Common::String &url) {
|
bool OSystem_MacOSX::openUrl(const Common::String &url) {
|
||||||
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
|
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (const UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
|
||||||
OSStatus err = LSOpenCFURLRef(urlRef, NULL);
|
OSStatus err = LSOpenCFURLRef(urlRef, NULL);
|
||||||
CFRelease(urlRef);
|
CFRelease(urlRef);
|
||||||
return err == noErr;
|
return err == noErr;
|
||||||
|
|
|
@ -85,7 +85,7 @@ void Credits::update() {
|
||||||
if (_linesRemaining) {
|
if (_linesRemaining) {
|
||||||
_linesRemaining--;
|
_linesRemaining--;
|
||||||
}
|
}
|
||||||
convertToWideChar(line, (byte *)" ", 40);
|
convertToWideChar(line, (const byte *)" ", 40);
|
||||||
}
|
}
|
||||||
_fontManager->_fonts[0]->renderToSurface(_surface, 0, (_yOffset + 200) % 208, line, 40);
|
_fontManager->_fonts[0]->renderToSurface(_surface, 0, (_yOffset + 200) % 208, line, 40);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void Credits::update() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Credits::convertToWideChar(uint16 *destBuf, byte *text, uint16 maxLength) {
|
void Credits::convertToWideChar(uint16 *destBuf, const byte *text, uint16 maxLength) {
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
for (int i = 0; i < maxLength; i++) {
|
for (int i = 0; i < maxLength; i++) {
|
||||||
if (text[i] == 0) {
|
if (text[i] == 0) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
void update();
|
void update();
|
||||||
private:
|
private:
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void convertToWideChar(uint16 *destBuf, byte *text, uint16 maxLength);
|
void convertToWideChar(uint16 *destBuf, const byte *text, uint16 maxLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Dragons
|
} // End of namespace Dragons
|
||||||
|
|
|
@ -80,9 +80,9 @@ void Screen::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, i
|
||||||
copyRectToSurface(srcSurface.getBasePtr(clipRect.left, clipRect.top), srcSurface.pitch, srcSurface.w, clipRect.left, destX, destY, clipRect.width(), clipRect.height(), flipX, alpha);
|
copyRectToSurface(srcSurface.getBasePtr(clipRect.left, clipRect.top), srcSurface.pitch, srcSurface.w, clipRect.left, destX, destY, clipRect.width(), clipRect.height(), flipX, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToSurface8bpp(const Graphics::Surface &srcSurface, byte *palette, int destX, int destY, const Common::Rect srcRect, bool flipX, AlphaBlendMode alpha, uint16 scale) {
|
void Screen::copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, const Common::Rect srcRect, bool flipX, AlphaBlendMode alpha, uint16 scale) {
|
||||||
if (scale != DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) {
|
if (scale != DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) {
|
||||||
drawScaledSprite(_backSurface, (byte *)srcSurface.getBasePtr(0, 0),
|
drawScaledSprite(_backSurface, (const byte *)srcSurface.getBasePtr(0, 0),
|
||||||
srcRect.width(), srcRect.height(),
|
srcRect.width(), srcRect.height(),
|
||||||
destX, destY,
|
destX, destY,
|
||||||
srcRect.width() * scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE, srcRect.height() * scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE,
|
srcRect.width() * scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE, srcRect.height() * scale / DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE,
|
||||||
|
@ -171,7 +171,7 @@ void Screen::copyRectToSurface(const void *buffer, int srcPitch, int srcWidth, i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToSurface8bpp(const void *buffer, byte* palette, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha) {
|
void Screen::copyRectToSurface8bpp(const void *buffer, const byte* palette, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha) {
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
|
|
||||||
assert(destX >= 0 && destX < _backSurface->w);
|
assert(destX >= 0 && destX < _backSurface->w);
|
||||||
|
@ -201,8 +201,8 @@ void Screen::copyRectToSurface8bpp(const void *buffer, byte* palette, int srcPit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::drawScaledSprite(Graphics::Surface *destSurface, byte *source, int sourceWidth, int sourceHeight,
|
void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight,
|
||||||
int destX, int destY, int destWidth, int destHeight, byte *palette, bool flipX, uint8 alpha) {
|
int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, uint8 alpha) {
|
||||||
// Based on the GNAP engine scaling code
|
// Based on the GNAP engine scaling code
|
||||||
if (destWidth == 0 || destHeight == 0) {
|
if (destWidth == 0 || destHeight == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -231,11 +231,11 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, byte *source, int
|
||||||
return;
|
return;
|
||||||
byte *dst = (byte *)destSurface->getBasePtr(destX, destY);
|
byte *dst = (byte *)destSurface->getBasePtr(destX, destY);
|
||||||
int yi = ys * clipY;
|
int yi = ys * clipY;
|
||||||
byte *hsrc = source + sourceWidth * ((yi + 0x8000) >> 16);
|
const byte *hsrc = source + sourceWidth * ((yi + 0x8000) >> 16);
|
||||||
for (int yc = 0; yc < destHeight; ++yc) {
|
for (int yc = 0; yc < destHeight; ++yc) {
|
||||||
byte *wdst = flipX ? dst + (destWidth - 1) * 2 : dst;
|
byte *wdst = flipX ? dst + (destWidth - 1) * 2 : dst;
|
||||||
int xi = flipX ? xs : xs * clipX;
|
int xi = flipX ? xs : xs * clipX;
|
||||||
byte *wsrc = hsrc + ((xi + 0x8000) >> 16);
|
const byte *wsrc = hsrc + ((xi + 0x8000) >> 16);
|
||||||
for (int xc = 0; xc < destWidth; ++xc) {
|
for (int xc = 0; xc < destWidth; ++xc) {
|
||||||
byte colorIndex = *wsrc;
|
byte colorIndex = *wsrc;
|
||||||
uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
|
uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
|
||||||
|
@ -328,7 +328,7 @@ void Screen::updatePaletteTransparency(uint16 paletteNum, uint16 startOffset, ui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::loadPalette(uint16 paletteNum, byte *palette) {
|
void Screen::loadPalette(uint16 paletteNum, const byte *palette) {
|
||||||
bool isTransPalette = (paletteNum & 0x8000);
|
bool isTransPalette = (paletteNum & 0x8000);
|
||||||
paletteNum &= ~0x8000;
|
paletteNum &= ~0x8000;
|
||||||
assert(paletteNum < DRAGONS_NUM_PALETTES);
|
assert(paletteNum < DRAGONS_NUM_PALETTES);
|
||||||
|
@ -394,7 +394,7 @@ void Screen::setScreenShakeOffset(int16 x, int16 y) {
|
||||||
_screenShakeOffset.y = y;
|
_screenShakeOffset.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface, byte *palette, int yOffset) {
|
void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface, const byte *palette, int yOffset) {
|
||||||
byte *dst = (byte *)_backSurface->getBasePtr(0, 0);
|
byte *dst = (byte *)_backSurface->getBasePtr(0, 0);
|
||||||
for (int i = 0; i < DRAGONS_SCREEN_HEIGHT; i++) {
|
for (int i = 0; i < DRAGONS_SCREEN_HEIGHT; i++) {
|
||||||
const byte *src = (const byte *)srcSurface.getPixels() + ((yOffset + i) % srcSurface.h) * srcSurface.pitch;
|
const byte *src = (const byte *)srcSurface.getPixels() + ((yOffset + i) % srcSurface.h) * srcSurface.pitch;
|
||||||
|
@ -408,7 +408,7 @@ void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, byte *palette, Common::Rect srcRect,
|
void Screen::copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, Common::Rect srcRect,
|
||||||
AlphaBlendMode alpha) {
|
AlphaBlendMode alpha) {
|
||||||
// Copy buffer data to internal buffer
|
// Copy buffer data to internal buffer
|
||||||
const byte *src = (const byte *)srcSurface.getBasePtr(0, 0);
|
const byte *src = (const byte *)srcSurface.getBasePtr(0, 0);
|
||||||
|
|
|
@ -71,10 +71,10 @@ public:
|
||||||
Graphics::PixelFormat getPixelFormat() { return _pixelFormat; }
|
Graphics::PixelFormat getPixelFormat() { return _pixelFormat; }
|
||||||
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
|
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
|
||||||
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE);
|
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE);
|
||||||
void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
|
void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
|
||||||
void copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, byte *palette, Common::Rect srcRect, AlphaBlendMode alpha = NONE);
|
void copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, Common::Rect srcRect, AlphaBlendMode alpha = NONE);
|
||||||
void updateScreen();
|
void updateScreen();
|
||||||
void loadPalette(uint16 paletteNum, byte *palette);
|
void loadPalette(uint16 paletteNum, const byte *palette);
|
||||||
byte *getPalette(uint16 paletteNum);
|
byte *getPalette(uint16 paletteNum);
|
||||||
void setPaletteRecord(uint16 paletteNum, uint16 offset, uint16 newValue);
|
void setPaletteRecord(uint16 paletteNum, uint16 offset, uint16 newValue);
|
||||||
void updatePaletteTransparency(uint16 paletteNum, uint16 startOffset, uint16 endOffset, bool isTransparent);
|
void updatePaletteTransparency(uint16 paletteNum, uint16 startOffset, uint16 endOffset, bool isTransparent);
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
|
|
||||||
void setScreenShakeOffset(int16 x, int16 y);
|
void setScreenShakeOffset(int16 x, int16 y);
|
||||||
|
|
||||||
void copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface, byte *palette, int yOffset);
|
void copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface, const byte *palette, int yOffset);
|
||||||
|
|
||||||
int16 addFlatQuad(int16 x0, int16 y0, int16 x1, int16 y1, int16 x3, int16 y3, int16 x2, int16 y2, uint16 colour, int16 priorityLayer, uint16 flags);
|
int16 addFlatQuad(int16 x0, int16 y0, int16 x1, int16 y1, int16 x3, int16 y3, int16 x2, int16 y2, uint16 colour, int16 priorityLayer, uint16 flags);
|
||||||
void drawFlatQuads(uint16 priorityLayer);
|
void drawFlatQuads(uint16 priorityLayer);
|
||||||
|
@ -95,8 +95,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void copyRectToSurface(const void *buffer, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
|
void copyRectToSurface(const void *buffer, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
|
||||||
void copyRectToSurface8bpp(const void *buffer, byte* palette, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
|
void copyRectToSurface8bpp(const void *buffer, const byte* palette, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
|
||||||
void drawScaledSprite(Graphics::Surface *destSurface, byte *source, int sourceWidth, int sourceHeight, int destX, int destY, int destWidth, int destHeight, byte *palette, bool flipX, uint8 alpha);
|
void drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight, int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, uint8 alpha);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Dragons
|
} // End of namespace Dragons
|
||||||
|
|
|
@ -55,21 +55,21 @@ bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
|
|
||||||
|
|
||||||
uint16 CelDecoder::getTransparentColourIndex() const {
|
uint16 CelDecoder::getTransparentColourIndex() const {
|
||||||
CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
|
const CelVideoTrack *track = (const CelVideoTrack *)getTrack(0);
|
||||||
if (!track)
|
if (!track)
|
||||||
return 0;
|
return 0;
|
||||||
return track->getTransparentColourIndex();
|
return track->getTransparentColourIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Graphics::Surface *CelDecoder::getCurrentFrame() const {
|
const Graphics::Surface *CelDecoder::getCurrentFrame() const {
|
||||||
CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
|
const CelVideoTrack *track = (const CelVideoTrack *)getTrack(0);
|
||||||
if (!track)
|
if (!track)
|
||||||
return 0;
|
return 0;
|
||||||
return track->getCurrentFrame();
|
return track->getCurrentFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Point CelDecoder::getCenter() const {
|
Common::Point CelDecoder::getCenter() const {
|
||||||
CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
|
const CelVideoTrack *track = (const CelVideoTrack *)getTrack(0);
|
||||||
if (!track)
|
if (!track)
|
||||||
return Common::Point(0, 0);
|
return Common::Point(0, 0);
|
||||||
return track->getCenter();
|
return track->getCenter();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue