aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-05-11 16:46:09 +0200
committerEinar Johan Trøan Sømåen2012-06-02 13:01:36 +0200
commit0d9ec2a0a9be9d92cb6c96c401bdfbea24edecf5 (patch)
tree796ccebaa3286affee56d960b46fd262dbc0ec7b /engines
parentff1b42259a16b927bff5e213a72aeb27e7dfd629 (diff)
downloadscummvm-rg350-0d9ec2a0a9be9d92cb6c96c401bdfbea24edecf5.tar.gz
scummvm-rg350-0d9ec2a0a9be9d92cb6c96c401bdfbea24edecf5.tar.bz2
scummvm-rg350-0d9ec2a0a9be9d92cb6c96c401bdfbea24edecf5.zip
WINTERMUTE: Remove a few warnings.
Diffstat (limited to 'engines')
-rw-r--r--engines/wintermute/BSurfaceSDL.cpp37
-rw-r--r--engines/wintermute/StringUtil.cpp10
-rw-r--r--engines/wintermute/coll_templ.h2
-rw-r--r--engines/wintermute/scriptables/ScScript.cpp6
-rw-r--r--engines/wintermute/scriptables/ScValue.cpp20
-rw-r--r--engines/wintermute/utils.cpp22
6 files changed, 53 insertions, 44 deletions
diff --git a/engines/wintermute/BSurfaceSDL.cpp b/engines/wintermute/BSurfaceSDL.cpp
index 710c623a43..ef97e8d7c2 100644
--- a/engines/wintermute/BSurfaceSDL.cpp
+++ b/engines/wintermute/BSurfaceSDL.cpp
@@ -36,7 +36,7 @@
#include "graphics/decoders/bmp.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
-#include "stream.h"
+#include "common/stream.h"
#include "BFileManager.h"
#include "PlatformSDL.h"
@@ -66,7 +66,7 @@ CBSurfaceSDL::~CBSurfaceSDL() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBSurfaceSDL::Create(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
- CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
+/* CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer); */
Common::String strFileName(Filename);
Graphics::ImageDecoder *imgDecoder;
@@ -120,10 +120,10 @@ HRESULT CBSurfaceSDL::Create(const char *Filename, bool default_ck, byte ck_red,
FreeImage_FlipVertical(img);*/
//TODO: This is rather endian-specific, but should be replaced by non-SDL-code anyhow:
- uint32 rmask = surface->format.rMax() << surface->format.rShift;
+/* uint32 rmask = surface->format.rMax() << surface->format.rShift;
uint32 gmask = surface->format.gMax() << surface->format.gShift;
uint32 bmask = surface->format.bMax() << surface->format.bShift;
- uint32 amask = surface->format.aMax();
+ uint32 amask = surface->format.aMax();*/
// SDL_Surface *surf = SDL_CreateRGBSurfaceFrom(surface->pixels, _width, _height, surface->format.bytesPerPixel * 8, surface->pitch, rmask, gmask, bmask, amask);
@@ -258,6 +258,7 @@ uint32 CBSurfaceSDL::GetPixel(Graphics::Surface *surface, int x, int y) {
return 0; /* shouldn't happen, but avoids warnings */
}
#endif
+ return 0;
}
//////////////////////////////////////////////////////////////////////////
@@ -296,8 +297,6 @@ HRESULT CBSurfaceSDL::CreateFromSDLSurface(Graphics::Surface *surface) {
//////////////////////////////////////////////////////////////////////////
bool CBSurfaceSDL::IsTransparentAt(int X, int Y) {
- int access;
- int width, height;
// This particular warning is rather messy, as this function is called a ton,
// thus we avoid printing it more than once.
static bool hasWarned = false;
@@ -305,6 +304,9 @@ bool CBSurfaceSDL::IsTransparentAt(int X, int Y) {
warning("CBSurfaceSDL::IsTransparentAt not ported yet");
hasWarned = true;
}
+#if 0
+ int access;
+ int width, height;
//SDL_QueryTexture(_texture, NULL, &access, &width, &height); //TODO
//if (access != SDL_TEXTUREACCESS_STREAMING) return false;
if (X < 0 || X >= width || Y < 0 || Y >= height) return true;
@@ -315,15 +317,14 @@ bool CBSurfaceSDL::IsTransparentAt(int X, int Y) {
EndPixelOp();
return ret;
+#endif
+ return 0;
}
//////////////////////////////////////////////////////////////////////////
bool CBSurfaceSDL::IsTransparentAtLite(int X, int Y) {
//if (!_lockPixels) return false;
- uint32 format;
- int access;
- int width, height;
// This particular warning is rather messy, as this function is called a ton,
// thus we avoid printing it more than once.
static bool hasWarned = false;
@@ -331,13 +332,19 @@ bool CBSurfaceSDL::IsTransparentAtLite(int X, int Y) {
warning("CBSurfaceSDL::IsTransparentAtLite not ported yet");
hasWarned = true;
}
+#if 0
+ uint32 format;
+ int access;
+ int width, height;
+
//SDL_QueryTexture(_texture, &format, &access, &width, &height);
//if (access != SDL_TEXTUREACCESS_STREAMING) return false;
if (X < 0 || X >= width || Y < 0 || Y >= height) return true;
if (!_alphaMask) return false;
else return _alphaMask[Y * width + X] <= 128;
-
+#endif
+ return false;
/*
Uint32* dst = (Uint32*)((Uint8*)_lockPixels + Y * _lockPitch);
Uint32 pixel = dst[X];
@@ -403,10 +410,6 @@ HRESULT CBSurfaceSDL::DrawSprite(int X, int Y, RECT *Rect, float ZoomX, float Zo
if (renderer->_forceAlphaColor != 0) Alpha = renderer->_forceAlphaColor;
- byte r = D3DCOLGetR(Alpha);
- byte g = D3DCOLGetG(Alpha);
- byte b = D3DCOLGetB(Alpha);
- byte a = D3DCOLGetA(Alpha);
// This particular warning is rather messy, as this function is called a ton,
// thus we avoid printing it more than once.
static bool hasWarned = false;
@@ -414,7 +417,13 @@ HRESULT CBSurfaceSDL::DrawSprite(int X, int Y, RECT *Rect, float ZoomX, float Zo
warning("CBSurfaceSDL::DrawSprite not fully ported yet"); // TODO.
hasWarned = true;
}
+ return S_OK;
#if 0
+ byte r = D3DCOLGetR(Alpha);
+ byte g = D3DCOLGetG(Alpha);
+ byte b = D3DCOLGetB(Alpha);
+ byte a = D3DCOLGetA(Alpha);
+
SDL_SetTextureColorMod(_texture, r, g, b);
SDL_SetTextureAlphaMod(_texture, a);
diff --git a/engines/wintermute/StringUtil.cpp b/engines/wintermute/StringUtil.cpp
index d98f60d582..35b3bd6fc7 100644
--- a/engines/wintermute/StringUtil.cpp
+++ b/engines/wintermute/StringUtil.cpp
@@ -269,7 +269,7 @@ AnsiString StringUtil::Replace(const AnsiString &str, const AnsiString &from, co
if (from.empty() || from == to) return str;
AnsiString result = str;
- size_t pos = 0;
+ /*size_t pos = 0;*/
while (result.contains(from)) {
const char *startPtr = strstr(result.c_str(), from.c_str());
@@ -323,11 +323,11 @@ int StringUtil::LastIndexOf(const WideString &str, const WideString &toFind, siz
/*size_t pos = str.rfind(toFind, startFrom);
if (pos == str.npos) return -1;
else return pos;*/
- uint32 lastIndex = -1;
+ int32 lastIndex = -1;
bool found = false;
- for (int i = startFrom; i < str.size(); i++) {
+ for (size_t i = startFrom; i < str.size(); i++) {
found = false;
- for (int j = 0; j < toFind.size(); j++) {
+ for (size_t j = 0; j < toFind.size(); j++) {
if (str[i + j] != toFind[j]) {
found = false;
break;
@@ -346,7 +346,7 @@ AnsiString StringUtil::ToString(size_t val) {
/* std::ostringstream str;
str << val;
return str.str();*/
- return Common::String::format("%u", val);
+ return Common::String::format("%u", (uint32)val);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h
index 0e0c3fbe75..ec6ef4f202 100644
--- a/engines/wintermute/coll_templ.h
+++ b/engines/wintermute/coll_templ.h
@@ -224,7 +224,7 @@ void CBArray<TYPE, ARG_TYPE>::SetSize(int nNewSize, int nGrowBy) {
_nSize = nNewSize;
} else {
// otherwise, grow array
- int nGrowBy = _nGrowBy;
+ nGrowBy = _nGrowBy;
if (nGrowBy == 0) {
// heuristically determine growth when nGrowBy == 0
// (this avoids heap fragmentation in many situations)
diff --git a/engines/wintermute/scriptables/ScScript.cpp b/engines/wintermute/scriptables/ScScript.cpp
index 611ce4124f..b3eca0f346 100644
--- a/engines/wintermute/scriptables/ScScript.cpp
+++ b/engines/wintermute/scriptables/ScScript.cpp
@@ -150,7 +150,7 @@ HRESULT CScScript::InitTables() {
TScriptHeader *Header = (TScriptHeader *)_buffer;
- uint32 i;
+ int32 i;
// load symbol table
_iP = Header->symbol_table;
@@ -471,7 +471,7 @@ HRESULT CScScript::ExecuteInstruction() {
case II_DEF_GLOB_VAR:
case II_DEF_CONST_VAR: {
dw = GetDWORD();
- char *Temp = _symbols[dw]; // TODO delete
+/* char *Temp = _symbols[dw]; // TODO delete */
// only create global var if it doesn't exist
if (!_engine->_globals->PropExists(_symbols[dw])) {
_operand->SetNULL();
@@ -1544,7 +1544,7 @@ HRESULT CScScript::DbgSendVariables(IWmeDebugClient *Client) {
// send scope variables
if (_scopeStack->_sP >= 0) {
for (int i = 0; i <= _scopeStack->_sP; i++) {
- CScValue *Scope = _scopeStack->GetAt(i);
+ // CScValue *Scope = _scopeStack->GetAt(i);
//Scope->DbgSendVariables(Client, WME_DBGVAR_SCOPE, this, (unsigned int)Scope);
}
}
diff --git a/engines/wintermute/scriptables/ScValue.cpp b/engines/wintermute/scriptables/ScValue.cpp
index 72baddbbc8..7720aa314c 100644
--- a/engines/wintermute/scriptables/ScValue.cpp
+++ b/engines/wintermute/scriptables/ScValue.cpp
@@ -724,13 +724,13 @@ HRESULT CScValue::Persist(CBPersistMgr *PersistMgr) {
PersistMgr->Transfer(TMEMBER(_valNative));
int size;
- char *str;
+ const char *str;
if (PersistMgr->_saving) {
size = _valObject.size();
PersistMgr->Transfer("", &size);
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
- str = (char *)_valIter->_key.c_str();
+ str = _valIter->_key.c_str();
PersistMgr->Transfer("", &str);
PersistMgr->Transfer("", &_valIter->_value);
@@ -800,7 +800,7 @@ HRESULT CScValue::SaveAsText(CBDynBuffer *Buffer, int Indent) {
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
Buffer->PutTextIndent(Indent, "PROPERTY {\n");
- Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", (char *)_valIter->_key.c_str());
+ Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", _valIter->_key.c_str());
Buffer->PutTextIndent(Indent + 2, "VALUE=\"%s\"\n", _valIter->_value->GetString());
Buffer->PutTextIndent(Indent, "}\n\n");
@@ -868,15 +868,15 @@ HRESULT CScValue::DbgSendVariables(IWmeDebugClient *Client, EWmeDebuggerVariable
//////////////////////////////////////////////////////////////////////////
bool CScValue::SetProperty(const char *PropName, int Value) {
CScValue *Val = new CScValue(Game, Value);
- bool Ret = SUCCEEDED(SetProp((char *)PropName, Val));
+ bool Ret = SUCCEEDED(SetProp(PropName, Val));
delete Val;
return Ret;
}
//////////////////////////////////////////////////////////////////////////
bool CScValue::SetProperty(const char *PropName, const char *Value) {
- CScValue *Val = new CScValue(Game, (char *)Value);
- bool Ret = SUCCEEDED(SetProp((char *)PropName, Val));
+ CScValue *Val = new CScValue(Game, Value);
+ bool Ret = SUCCEEDED(SetProp(PropName, Val));
delete Val;
return Ret;
}
@@ -884,7 +884,7 @@ bool CScValue::SetProperty(const char *PropName, const char *Value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::SetProperty(const char *PropName, double Value) {
CScValue *Val = new CScValue(Game, Value);
- bool Ret = SUCCEEDED(SetProp((char *)PropName, Val));
+ bool Ret = SUCCEEDED(SetProp(PropName, Val));
delete Val;
return Ret;
}
@@ -893,7 +893,7 @@ bool CScValue::SetProperty(const char *PropName, double Value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::SetProperty(const char *PropName, bool Value) {
CScValue *Val = new CScValue(Game, Value);
- bool Ret = SUCCEEDED(SetProp((char *)PropName, Val));
+ bool Ret = SUCCEEDED(SetProp(PropName, Val));
delete Val;
return Ret;
}
@@ -902,7 +902,7 @@ bool CScValue::SetProperty(const char *PropName, bool Value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::SetProperty(const char *PropName) {
CScValue *Val = new CScValue(Game);
- bool Ret = SUCCEEDED(SetProp((char *)PropName, Val));
+ bool Ret = SUCCEEDED(SetProp(PropName, Val));
delete Val;
return Ret;
}
@@ -977,7 +977,7 @@ bool CScValue::DbgSetVal(bool Value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::DbgSetVal(const char *Value) {
- SetString((char *)Value);
+ SetString(Value);
return true;
}
diff --git a/engines/wintermute/utils.cpp b/engines/wintermute/utils.cpp
index 13885dd2e6..7f17af9395 100644
--- a/engines/wintermute/utils.cpp
+++ b/engines/wintermute/utils.cpp
@@ -129,7 +129,7 @@ char *CBUtils::SetString(char **String, const char *Value) {
//////////////////////////////////////////////////////////////////////////
int CBUtils::StrNumEntries(const char *Str, const char Delim) {
int NumEntries = 1;
- for (int i = 0; i < strlen(Str); i++) {
+ for (uint32 i = 0; i < strlen(Str); i++) {
if (Str[i] == Delim) NumEntries++;
}
return NumEntries;
@@ -143,7 +143,7 @@ char *CBUtils::StrEntry(int Entry, const char *Str, const char Delim) {
const char *Start = NULL;
int Len = 0;
- for (int i = 0; i <= strlen(Str); i++) {
+ for (uint32 i = 0; i <= strlen(Str); i++) {
if (NumEntries == Entry) {
if (!Start) Start = Str + i;
else Len++;
@@ -294,9 +294,9 @@ void CBUtils::RGBtoHSL(uint32 RGBColor, byte *OutH, byte *OutS, byte *OutL) {
if (H > 1) H -= 1;
}
- *OutH = H * 255;
- *OutS = S * 255;
- *OutL = L * 255;
+ *OutH = (byte)(H * 255);
+ *OutS = (byte)(S * 255);
+ *OutL = (byte)(L * 255);
}
@@ -310,9 +310,9 @@ uint32 CBUtils::HSLtoRGB(byte InH, byte InS, byte InL) {
if (S == 0) {
- R = L * 255;
- G = L * 255;
- B = L * 255;
+ R = (byte)(L * 255);
+ G = (byte)(L * 255);
+ B = (byte)(L * 255);
} else {
float var_1, var_2;
@@ -321,9 +321,9 @@ uint32 CBUtils::HSLtoRGB(byte InH, byte InS, byte InL) {
var_1 = 2.0f * L - var_2;
- R = 255 * Hue2RGB(var_1, var_2, H + (1.0f / 3.0f));
- G = 255 * Hue2RGB(var_1, var_2, H);
- B = 255 * Hue2RGB(var_1, var_2, H - (1.0f / 3.0f));
+ R = (byte)(255 * Hue2RGB(var_1, var_2, H + (1.0f / 3.0f)));
+ G = (byte)(255 * Hue2RGB(var_1, var_2, H));
+ B = (byte)(255 * Hue2RGB(var_1, var_2, H - (1.0f / 3.0f)));
}
return DRGBA(255, R, G, B);
}