diff --git a/engines/wintermute/BSurfaceSDL.cpp b/engines/wintermute/BSurfaceSDL.cpp index 710c623a437..ef97e8d7c2a 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(Game->_renderer); +/* CBRenderSDL *renderer = static_cast(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 d98f60d582a..35b3bd6fc78 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 0e0c3fbe75a..ec6ef4f202a 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -224,7 +224,7 @@ void CBArray::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 611ce4124f9..b3eca0f346f 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 72baddbbc8b..7720aa314c6 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 13885dd2e62..7f17af93955 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); }