aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-25 16:14:28 +0200
committerEinar Johan Trøan Sømåen2012-06-25 16:14:28 +0200
commit58b8b371fe579292b41e272145c0c20ff13ab70b (patch)
tree4642a6cded2b1c9ee87814daf038449337592adc
parent4c61cf042b09a64593a8beb6e1e9d72a883a7cda (diff)
downloadscummvm-rg350-58b8b371fe579292b41e272145c0c20ff13ab70b.tar.gz
scummvm-rg350-58b8b371fe579292b41e272145c0c20ff13ab70b.tar.bz2
scummvm-rg350-58b8b371fe579292b41e272145c0c20ff13ab70b.zip
WINTERMUTE: Fix even more warnings
-rw-r--r--engines/wintermute/Ad/AdObject.cpp8
-rw-r--r--engines/wintermute/Base/BBase.cpp2
-rw-r--r--engines/wintermute/Base/BFader.cpp2
-rw-r--r--engines/wintermute/Base/BFontTT.cpp8
-rw-r--r--engines/wintermute/Base/BGame.cpp8
-rw-r--r--engines/wintermute/Base/BRenderSDL.cpp24
-rw-r--r--engines/wintermute/Base/BScriptHolder.cpp2
-rw-r--r--engines/wintermute/Base/BSurfaceSDL.cpp4
-rw-r--r--engines/wintermute/Base/BTransitionMgr.cpp4
-rw-r--r--engines/wintermute/Base/PartEmitter.cpp8
-rw-r--r--engines/wintermute/Base/file/BSaveThumbFile.cpp2
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.cpp2
-rw-r--r--engines/wintermute/PlatformSDL.cpp4
-rw-r--r--engines/wintermute/Sys/SysClassRegistry.cpp8
-rw-r--r--engines/wintermute/UI/UIButton.cpp3
15 files changed, 46 insertions, 43 deletions
diff --git a/engines/wintermute/Ad/AdObject.cpp b/engines/wintermute/Ad/AdObject.cpp
index 816821568e..896bdfdaf5 100644
--- a/engines/wintermute/Ad/AdObject.cpp
+++ b/engines/wintermute/Ad/AdObject.cpp
@@ -1143,8 +1143,8 @@ HRESULT CAdObject::DisplaySpriteAttachment(CAdObject *Attachment) {
int OrigY = Attachment->_posY;
// inherit position from owner
- Attachment->_posX = this->_posX + Attachment->_posX * ScaleX / 100.0f;
- Attachment->_posY = this->_posY + Attachment->_posY * ScaleY / 100.0f;
+ Attachment->_posX = (int)(this->_posX + Attachment->_posX * ScaleX / 100.0f);
+ Attachment->_posY = (int)(this->_posY + Attachment->_posY * ScaleY / 100.0f);
// inherit other props
Attachment->_alphaColor = this->_alphaColor;
@@ -1194,8 +1194,8 @@ HRESULT CAdObject::UpdatePartEmitter() {
float ScaleX, ScaleY;
GetScale(&ScaleX, &ScaleY);
- _partEmitter->_posX = _posX + (ScaleX / 100.0f) * _partOffsetX;
- _partEmitter->_posY = _posY + (ScaleY / 100.0f) * _partOffsetY;
+ _partEmitter->_posX = (int)(_posX + (ScaleX / 100.0f) * _partOffsetX);
+ _partEmitter->_posY = (int)(_posY + (ScaleY / 100.0f) * _partOffsetY);
}
return _partEmitter->Update();
}
diff --git a/engines/wintermute/Base/BBase.cpp b/engines/wintermute/Base/BBase.cpp
index 8f9d306824..97e7864dea 100644
--- a/engines/wintermute/Base/BBase.cpp
+++ b/engines/wintermute/Base/BBase.cpp
@@ -163,7 +163,7 @@ HRESULT CBBase::SaveAsText(CBDynBuffer *Buffer, int Indent) {
while (_editorPropsIter != _editorProps.end()) {
Buffer->PutTextIndent(Indent, "EDITOR_PROPERTY\n");
Buffer->PutTextIndent(Indent, "{\n");
- Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", (char *)_editorPropsIter->_key.c_str());
+ Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", _editorPropsIter->_key.c_str());
Buffer->PutTextIndent(Indent + 2, "VALUE=\"%s\"\n", _editorPropsIter->_value.c_str());
//Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", (char *)_editorPropsIter->first.c_str()); // <- TODO, remove
//Buffer->PutTextIndent(Indent + 2, "VALUE=\"%s\"\n", _editorPropsIter->second.c_str()); // <- TODO, remove
diff --git a/engines/wintermute/Base/BFader.cpp b/engines/wintermute/Base/BFader.cpp
index cd78ece27a..b20d377e93 100644
--- a/engines/wintermute/Base/BFader.cpp
+++ b/engines/wintermute/Base/BFader.cpp
@@ -72,7 +72,7 @@ HRESULT CBFader::Update() {
if (time >= _duration) _currentAlpha = _targetAlpha;
else {
- _currentAlpha = _sourceAlpha + (float)time / (float)_duration * AlphaDelta;
+ _currentAlpha = (byte)(_sourceAlpha + (float)time / (float)_duration * AlphaDelta);
}
_currentAlpha = MIN((unsigned char)255, MAX(_currentAlpha, (byte)0)); // TODO: clean
diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp
index d7ab99a026..81dca9d293 100644
--- a/engines/wintermute/Base/BFontTT.cpp
+++ b/engines/wintermute/Base/BFontTT.cpp
@@ -261,14 +261,14 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex
warning("%s %d %d %d %d", text.c_str(), D3DCOLGetR(_layers[0]->_color), D3DCOLGetG(_layers[0]->_color), D3DCOLGetB(_layers[0]->_color), D3DCOLGetA(_layers[0]->_color));
// void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
Graphics::Surface *surface = new Graphics::Surface();
- surface->create(width, _lineHeight * lines.size(), Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15));
+ surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15));
uint16 useColor = 0xffff;
Common::Array<Common::String>::iterator it;
int heightOffset = 0;
for (it = lines.begin(); it != lines.end(); it++) {
_font->drawString(surface, *it, 0, heightOffset, width, useColor, alignment);
- heightOffset += _lineHeight;
+ heightOffset += (int)_lineHeight;
}
CBSurfaceSDL *retSurface = new CBSurfaceSDL(Game);
@@ -399,7 +399,7 @@ void CBFontTT::BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Co
//////////////////////////////////////////////////////////////////////////
int CBFontTT::GetLetterHeight() {
- return GetLineHeight();
+ return (int)GetLineHeight();
}
@@ -641,7 +641,7 @@ HRESULT CBFontTT::InitFont() {
if (!file) {
// the requested font file is not in wme file space; try loading a system font
AnsiString fontFileName = PathUtil::Combine(CBPlatform::GetSystemFontPath(), PathUtil::GetFileName(_fontFile));
- file = Game->_fileManager->OpenFile((char *)fontFileName.c_str(), false);
+ file = Game->_fileManager->OpenFile(fontFileName.c_str(), false);
if (!file) {
Game->LOG(0, "Error loading TrueType font '%s'", _fontFile);
//return E_FAIL;
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 69a0a31288..3ccd6d6a12 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -197,7 +197,7 @@ CBGame::CBGame(): CBObject(this) {
_subtitlesSpeed = 70;
- _resourceModule = NULL;
+ _resourceModule = 0;
_forceNonStreamedSounds = false;
@@ -568,10 +568,10 @@ void CBGame::DEBUG_DebugDisable() {
//////////////////////////////////////////////////////////////////////
void CBGame::LOG(HRESULT res, LPCSTR fmt, ...) {
- int secs = g_system->getMillis() / 1000;
- int hours = secs / 3600;
+ uint32 secs = g_system->getMillis() / 1000;
+ uint32 hours = secs / 3600;
secs = secs % 3600;
- int mins = secs / 60;
+ uint32 mins = secs / 60;
secs = secs % 60;
char buff[512];
diff --git a/engines/wintermute/Base/BRenderSDL.cpp b/engines/wintermute/Base/BRenderSDL.cpp
index 80c3372c62..f372335cf1 100644
--- a/engines/wintermute/Base/BRenderSDL.cpp
+++ b/engines/wintermute/Base/BRenderSDL.cpp
@@ -286,10 +286,10 @@ HRESULT CBRenderSDL::FadeToColor(uint32 Color, Common::Rect *rect) {
} else {
RECT rc;
Game->GetCurrentViewportRect(&rc);
- fillRect.left = rc.left;
- fillRect.top = rc.top;
- fillRect.setWidth(rc.right - rc.left);
- fillRect.setHeight(rc.bottom - rc.top);
+ fillRect.left = (int16)rc.left;
+ fillRect.top = (int16)rc.top;
+ fillRect.setWidth((int16)(rc.right - rc.left));
+ fillRect.setHeight((int16)(rc.bottom - rc.top));
}
ModTargetRect(&fillRect);
@@ -337,19 +337,19 @@ void CBRenderSDL::drawOpaqueFromSurface(Graphics::Surface *surf, Common::Rect *s
// Handle off-screen clipping
if (posY < 0) {
- img->h = MAX(0, (int)img->h - -posY);
+ img->h = (uint16)(MAX(0, (int)img->h - -posY));
img->pixels = (byte *)img->pixels + img->pitch * -posY;
posY = 0;
}
if (posX < 0) {
- img->w = MAX(0, (int)img->w - -posX);
+ img->w = (uint16)(MAX(0, (int)img->w - -posX));
img->pixels = (byte *)img->pixels + (-posX * 4);
posX = 0;
}
- img->w = CLIP((int)img->w, 0, (int)MAX((int)_renderSurface->w - posX, 0));
- img->h = CLIP((int)img->h, 0, (int)MAX((int)_renderSurface->h - posY, 0));
+ img->w = (uint16)(CLIP((int)img->w, 0, (int)MAX((int)_renderSurface->w - posX, 0)));
+ img->h = (uint16)(CLIP((int)img->h, 0, (int)MAX((int)_renderSurface->h - posY, 0)));
for (int i = 0; i < img->h; i++) {
void *destPtr = _renderSurface->getBasePtr(posX, posY + i);
@@ -457,10 +457,10 @@ const char *CBRenderSDL::GetName() {
HRESULT CBRenderSDL::SetViewport(int left, int top, int right, int bottom) {
Common::Rect rect;
// TODO: Hopefully this is the same logic that ScummVM uses.
- rect.left = left + _borderLeft;
- rect.top = top + _borderTop;
- rect.right = (right - left) * _ratioX;
- rect.bottom = (bottom - top) * _ratioY;
+ rect.left = (int16)(left + _borderLeft);
+ rect.top = (int16)(top + _borderTop);
+ rect.right = (int16)((right - left) * _ratioX);
+ rect.bottom = (int16)((bottom - top) * _ratioY);
// TODO fix this once viewports work correctly in SDL/landscape
#ifndef __IPHONEOS__
diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp
index 0dfeab4b07..a721619538 100644
--- a/engines/wintermute/Base/BScriptHolder.cpp
+++ b/engines/wintermute/Base/BScriptHolder.cpp
@@ -467,7 +467,7 @@ void CBScriptHolder::ScDebuggerDesc(char *Buf, int BufSize) {
// IWmeObject
//////////////////////////////////////////////////////////////////////////
bool CBScriptHolder::SendEvent(const char *EventName) {
- return SUCCEEDED(ApplyEvent((char *)EventName));
+ return SUCCEEDED(ApplyEvent(EventName));
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSurfaceSDL.cpp b/engines/wintermute/Base/BSurfaceSDL.cpp
index 618c155b36..3bac8ecc78 100644
--- a/engines/wintermute/Base/BSurfaceSDL.cpp
+++ b/engines/wintermute/Base/BSurfaceSDL.cpp
@@ -518,8 +518,8 @@ HRESULT CBSurfaceSDL::drawSprite(int x, int y, RECT *Rect, float ZoomX, float Zo
// TODO: This actually requires us to have the SAME source-offsets every time,
// But no checking is in place for that yet.
Graphics::Surface drawSrc;
- drawSrc.w = position.width();
- drawSrc.h = position.height();
+ drawSrc.w = (uint16)position.width();
+ drawSrc.h = (uint16)position.height();
drawSrc.format = _surface->format;
if (position.width() != srcRect.width() || position.height() != srcRect.height()) {
diff --git a/engines/wintermute/Base/BTransitionMgr.cpp b/engines/wintermute/Base/BTransitionMgr.cpp
index 500f2a961d..1a9d9008c6 100644
--- a/engines/wintermute/Base/BTransitionMgr.cpp
+++ b/engines/wintermute/Base/BTransitionMgr.cpp
@@ -97,7 +97,7 @@ HRESULT CBTransitionMgr::Update() {
case TRANSITION_FADE_OUT: {
uint32 time = CBPlatform::GetTime() - _lastTime;
- int Alpha = 255 - (float)time / (float)FADE_DURATION * 255;
+ int Alpha = (int)(255 - (float)time / (float)FADE_DURATION * 255);
Alpha = MIN(255, MAX(Alpha, 0));
Game->_renderer->Fade((uint16)Alpha);
@@ -107,7 +107,7 @@ HRESULT CBTransitionMgr::Update() {
case TRANSITION_FADE_IN: {
uint32 time = CBPlatform::GetTime() - _lastTime;
- int Alpha = (float)time / (float)FADE_DURATION * 255;
+ int Alpha = (int)((float)time / (float)FADE_DURATION * 255);
Alpha = MIN(255, MAX(Alpha, 0));
Game->_renderer->Fade((uint16)Alpha);
diff --git a/engines/wintermute/Base/PartEmitter.cpp b/engines/wintermute/Base/PartEmitter.cpp
index 1c845f88be..a3c1843b82 100644
--- a/engines/wintermute/Base/PartEmitter.cpp
+++ b/engines/wintermute/Base/PartEmitter.cpp
@@ -178,10 +178,10 @@ HRESULT CPartEmitter::InitParticle(CPartParticle *Particle, uint32 CurrentTime,
float GrowthRate = CBUtils::RandomFloat(_growthRate1, _growthRate2);
if (!CBPlatform::IsRectEmpty(&_border)) {
- int ThicknessLeft = _borderThicknessLeft - (float)_borderThicknessLeft * PosZ / 100.0f;
- int ThicknessRight = _borderThicknessRight - (float)_borderThicknessRight * PosZ / 100.0f;
- int ThicknessTop = _borderThicknessTop - (float)_borderThicknessTop * PosZ / 100.0f;
- int ThicknessBottom = _borderThicknessBottom - (float)_borderThicknessBottom * PosZ / 100.0f;
+ int ThicknessLeft = (int)(_borderThicknessLeft - (float)_borderThicknessLeft * PosZ / 100.0f);
+ int ThicknessRight = (int)(_borderThicknessRight - (float)_borderThicknessRight * PosZ / 100.0f);
+ int ThicknessTop = (int)(_borderThicknessTop - (float)_borderThicknessTop * PosZ / 100.0f);
+ int ThicknessBottom = (int)(_borderThicknessBottom - (float)_borderThicknessBottom * PosZ / 100.0f);
Particle->_border = _border;
Particle->_border.left += ThicknessLeft;
diff --git a/engines/wintermute/Base/file/BSaveThumbFile.cpp b/engines/wintermute/Base/file/BSaveThumbFile.cpp
index 062cda4b83..5f5278199b 100644
--- a/engines/wintermute/Base/file/BSaveThumbFile.cpp
+++ b/engines/wintermute/Base/file/BSaveThumbFile.cpp
@@ -137,7 +137,7 @@ HRESULT CBSaveThumbFile::Seek(uint32 pos, TSeek origin) {
break;
}
- if (newPos < 0 || newPos > _size) return E_FAIL;
+ if (newPos > _size) return E_FAIL;
else _pos = newPos;
return S_OK;
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp
index a8bfc10800..c3c376790f 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.cpp
+++ b/engines/wintermute/Base/scriptables/ScEngine.cpp
@@ -94,7 +94,7 @@ CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) {
#else
*/
_compilerAvailable = false;
- _compilerDLL = NULL;
+ _compilerDLL = 0;
//#endif
diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp
index 9eb1970f11..37270d8834 100644
--- a/engines/wintermute/PlatformSDL.cpp
+++ b/engines/wintermute/PlatformSDL.cpp
@@ -167,7 +167,7 @@ int CBPlatform::SDLEventWatcher(void *userdata, Common::Event *event) {
// Win32 API bindings
//////////////////////////////////////////////////////////////////////////
HINSTANCE CBPlatform::ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int nShowCmd) {
- return NULL;
+ return 0;
}
//////////////////////////////////////////////////////////////////////////
@@ -236,7 +236,7 @@ bool CBPlatform::CopyFile(const char *from, const char *to, bool failIfExists) {
//////////////////////////////////////////////////////////////////////////
HWND CBPlatform::SetCapture(HWND hWnd) {
- return NULL;
+ return 0;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Sys/SysClassRegistry.cpp b/engines/wintermute/Sys/SysClassRegistry.cpp
index 0a41b59d35..7025e4c79a 100644
--- a/engines/wintermute/Sys/SysClassRegistry.cpp
+++ b/engines/wintermute/Sys/SysClassRegistry.cpp
@@ -177,7 +177,7 @@ HRESULT CSysClassRegistry::SaveTable(CBGame *Game, CBPersistMgr *persistMgr, boo
counter++;
if (!quickSave) {
- Game->_indicatorProgress = 50.0f / (float)((float)_classes.size() / (float)counter);
+ Game->_indicatorProgress = (int)(50.0f / (float)((float)_classes.size() / (float)counter));
Game->DisplayContent(false);
Game->_renderer->Flip();
}
@@ -206,10 +206,10 @@ HRESULT CSysClassRegistry::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) {
_instanceMap.clear();
- int numClasses = persistMgr->getDWORD();
+ uint32 numClasses = persistMgr->getDWORD();
- for (int i = 0; i < numClasses; i++) {
- Game->_indicatorProgress = 50.0f / (float)((float)numClasses / (float)i);
+ for (uint32 i = 0; i < numClasses; i++) {
+ Game->_indicatorProgress = (int)(50.0f / (float)((float)numClasses / (float)i));
Game->DisplayContentSimple();
Game->_renderer->Flip();
diff --git a/engines/wintermute/UI/UIButton.cpp b/engines/wintermute/UI/UIButton.cpp
index 93bef195ea..9ce8230104 100644
--- a/engines/wintermute/UI/UIButton.cpp
+++ b/engines/wintermute/UI/UIButton.cpp
@@ -501,6 +501,9 @@ HRESULT CUIButton::SaveAsText(CBDynBuffer *Buffer, int Indent) {
case TAL_CENTER:
Buffer->PutTextIndent(Indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
break;
+ default:
+ warning("CUIButton::SaveAsText - unhandled enum");
+ break;
}
Buffer->PutTextIndent(Indent + 2, "\n");