diff --git a/CMakeLists.txt b/CMakeLists.txt index 1769f884d..9de8efeb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -613,8 +613,10 @@ if (WIN32) 4127 # Conditional expression is constant 4242 # Storing value in a variable of a smaller type, possible loss of data 4244 # Storing value of one type in variable of another (size_t in int, for example) + 4267 # Conversion from 'size_t' to 'int', possible loss of data 4305 # Truncating value (double to float, for example) 4309 # Variable overflow, trying to store 128 in a signed char for example + 4351 # New behavior: elements of array 'array' will be default initialized (desired behavior) 4355 # Using 'this' in member initialization list 4505 # Unreferenced local function has been removed 4701 # Potentially uninitialized local variable used @@ -633,7 +635,9 @@ if (WIN32) set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101") set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS}) set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS}) - set_target_properties(oics PROPERTIES COMPILE_FLAGS ${WARNINGS}) + # oics uses tinyxml, which has an initialized but unused variable + set(OICS_WARNINGS "${WARNINGS} /wd4189") + set_target_properties(oics PROPERTIES COMPILE_FLAGS ${OICS_WARNINGS}) set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS}) if (BUILD_LAUNCHER) set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS}) diff --git a/apps/opencs/model/doc/loader.cpp b/apps/opencs/model/doc/loader.cpp index c106c06e8..6fb10426c 100644 --- a/apps/opencs/model/doc/loader.cpp +++ b/apps/opencs/model/doc/loader.cpp @@ -39,6 +39,7 @@ void CSMDoc::Loader::load() Document *document = iter->first; int size = static_cast (document->getContentFiles().size()); + int editedIndex = size-1; // index of the file to be edited/created if (document->isNew()) --size; @@ -77,7 +78,7 @@ void CSMDoc::Loader::load() { boost::filesystem::path path = document->getContentFiles()[iter->second.mFile]; - int steps = document->getData().startLoading (path, iter->second.mFilegetData().startLoading (path, iter->second.mFile!=editedIndex, false); iter->second.mRecordsLeft = true; emit nextStage (document, path.filename().string(), steps/batchingSize); diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 52e7afefd..eccaebd00 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -87,7 +87,7 @@ namespace CSVRender std::stringstream windowHandle; #ifdef WIN32 - windowHandle << Ogre::StringConverter::toString((unsigned long)(this->winId())); + windowHandle << Ogre::StringConverter::toString((uintptr_t)(this->winId())); #else windowHandle << this->winId(); #endif diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index a061cf63c..adde408b9 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -299,8 +299,10 @@ int main(int argc, char**argv) std::streambuf* cout_rdbuf = std::cout.rdbuf (); std::streambuf* cerr_rdbuf = std::cerr.rdbuf (); +#if !(defined(_WIN32) && defined(_DEBUG)) boost::iostreams::stream_buffer coutsb; boost::iostreams::stream_buffer cerrsb; +#endif std::ostream oldcout(cout_rdbuf); std::ostream oldcerr(cerr_rdbuf); diff --git a/apps/openmw/mwgui/list.cpp b/apps/openmw/mwgui/list.cpp index ca2989646..b0c514b9d 100644 --- a/apps/openmw/mwgui/list.cpp +++ b/apps/openmw/mwgui/list.cpp @@ -101,7 +101,7 @@ namespace MWGui size_t viewRange = mScrollView->getCanvasSize().height; if(viewPosition > viewRange) viewPosition = viewRange; - mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); + mScrollView->setViewOffset(MyGUI::IntPoint(0, viewPosition * -1)); } void MWList::setPropertyOverride(const std::string &_key, const std::string &_value) diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 2b0323675..62907fcc3 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -319,7 +319,7 @@ void LocalMap::createFogOfWar(const std::string& texturePrefix) std::vector buffer; // initialize to (0, 0, 0, 1) - buffer.resize(sFogOfWarResolution*sFogOfWarResolution, (255 << 24)); + buffer.resize(sFogOfWarResolution*sFogOfWarResolution, 0xFF000000); // upload to the texture memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4); diff --git a/apps/openmw/mwrender/refraction.cpp b/apps/openmw/mwrender/refraction.cpp index c2809a1aa..7d728b721 100644 --- a/apps/openmw/mwrender/refraction.cpp +++ b/apps/openmw/mwrender/refraction.cpp @@ -35,7 +35,7 @@ namespace MWRender vp->setShadowsEnabled(false); vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky + RV_FirstPerson); vp->setMaterialScheme("water_refraction"); - vp->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); + vp->setBackgroundColour (Ogre::ColourValue(0.090195, 0.115685, 0.12745)); mRenderTarget->setAutoUpdated(true); mRenderTarget->addListener(this); } diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 89933414d..ee1cbfe5d 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -531,9 +531,10 @@ void RenderingManager::applyFog (bool underwater) } else { - mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(0.18039, 0.23137, 0.25490), 0, 0, 1000); - mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); - mWater->setViewportBackground (Ogre::ColourValue(0.18039, 0.23137, 0.25490)); + Ogre::ColourValue clv(0.090195, 0.115685, 0.12745); + mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(clv), 0, 0, 1000); + mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(clv)); + mWater->setViewportBackground (Ogre::ColourValue(clv)); } } @@ -640,12 +641,12 @@ void RenderingManager::sunDisable(bool real) } } -void RenderingManager::setSunDirection(const Ogre::Vector3& direction) +void RenderingManager::setSunDirection(const Ogre::Vector3& direction, bool is_moon) { // direction * -1 (because 'direction' is camera to sun vector and not sun to camera), if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z)); - mSkyManager->setSunDirection(direction); + mSkyManager->setSunDirection(direction, is_moon); } void RenderingManager::setGlare(bool glare) diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index f539f9270..ea7905cf5 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -145,7 +145,7 @@ public: void setAmbientColour(const Ogre::ColourValue& colour); void setSunColour(const Ogre::ColourValue& colour); - void setSunDirection(const Ogre::Vector3& direction); + void setSunDirection(const Ogre::Vector3& direction, bool is_moon); void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0) void sunDisable(bool real); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 2bbc95c89..66a99feb7 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -666,14 +666,14 @@ void SkyManager::sunDisable() mSunEnabled = false; } -void SkyManager::setSunDirection(const Vector3& direction) +void SkyManager::setSunDirection(const Vector3& direction, bool is_moon) { if (!mCreated) return; mSun->setPosition(direction); mSunGlare->setPosition(direction); float height = direction.z; - float fade = ( height > 0.5) ? 1.0 : height * 2; + float fade = is_moon ? 0.0 : (( height > 0.5) ? 1.0 : height * 2); sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty(new sh::Vector2(fade, height))); } diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index f81a42782..f752011c0 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -150,7 +150,7 @@ namespace MWRender void setRainSpeed(float speed); - void setSunDirection(const Ogre::Vector3& direction); + void setSunDirection(const Ogre::Vector3& direction, bool is_moon); void setMasserDirection(const Ogre::Vector3& direction); diff --git a/apps/openmw/mwrender/videoplayer.cpp b/apps/openmw/mwrender/videoplayer.cpp index 79f2fa948..03e74697c 100644 --- a/apps/openmw/mwrender/videoplayer.cpp +++ b/apps/openmw/mwrender/videoplayer.cpp @@ -747,7 +747,7 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts) * buffer. We use this to store the global_pts in * a frame at the time it is allocated. */ -static uint64_t global_video_pkt_pts = AV_NOPTS_VALUE; +static uint64_t global_video_pkt_pts = static_cast(AV_NOPTS_VALUE); static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic) { int ret = avcodec_default_get_buffer(c, pic); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 200c50e69..ba7b4f3ba 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -386,7 +386,7 @@ namespace MWSound sound = mOutput->playSound3D(file, initialPos, volume, basevol, pitch, min, max, mode|type, offset); mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId); } - catch(std::exception &e) + catch(std::exception &) { //std::cout <<"Sound Error: "< 13.f) ? 1 : -1; + bool sun_is_moon = mHour >= mNightStart || mHour <= mSunriseTime; + Vector3 final( (height - 1) * facing, (height - 1) * facing, height); - mRendering->setSunDirection(final); + mRendering->setSunDirection(final, sun_is_moon); /* * TODO: import separated fadeInStart/Finish, fadeOutStart/Finish diff --git a/components/terrain/buffercache.cpp b/components/terrain/buffercache.cpp index f693c0e40..a3e67af5b 100644 --- a/components/terrain/buffercache.cpp +++ b/components/terrain/buffercache.cpp @@ -118,7 +118,7 @@ namespace Terrain // North row = verts-1; - outerStep = 1 << (lodDeltas[North] + lodLevel); + outerStep = size_t(1) << (lodDeltas[North] + lodLevel); for (size_t col = 0; col < verts-1; col += outerStep) { indices.push_back(verts*(col+outerStep)+row); @@ -142,7 +142,7 @@ namespace Terrain // West size_t col = 0; - outerStep = 1 << (lodDeltas[West] + lodLevel); + outerStep = size_t(1) << (lodDeltas[West] + lodLevel); for (size_t row = 0; row < verts-1; row += outerStep) { indices.push_back(verts*col+row+outerStep); @@ -166,7 +166,7 @@ namespace Terrain // East col = verts-1; - outerStep = 1 << (lodDeltas[East] + lodLevel); + outerStep = size_t(1) << (lodDeltas[East] + lodLevel); for (size_t row = 0; row < verts-1; row += outerStep) { indices.push_back(verts*col+row); diff --git a/extern/sdl4ogre/sdlwindowhelper.cpp b/extern/sdl4ogre/sdlwindowhelper.cpp index 2a14cc6b4..3ea39cff7 100644 --- a/extern/sdl4ogre/sdlwindowhelper.cpp +++ b/extern/sdl4ogre/sdlwindowhelper.cpp @@ -32,7 +32,7 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h, #ifdef WIN32 case SDL_SYSWM_WINDOWS: // Windows code - winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window); + winHandle = Ogre::StringConverter::toString((uintptr_t)wmInfo.info.win.window); break; #elif __MACOSX__ case SDL_SYSWM_COCOA: diff --git a/files/materials/underwater.h b/files/materials/underwater.h index 8474f299d..332a0fd7d 100644 --- a/files/materials/underwater.h +++ b/files/materials/underwater.h @@ -1,4 +1,4 @@ -#define UNDERWATER_COLOUR float3(0.18039, 0.23137, 0.25490) +#define UNDERWATER_COLOUR float3(0.090195, 0.115685, 0.12745) #define VISIBILITY 1000.0 // how far you can look through water diff --git a/files/materials/water.shader b/files/materials/water.shader index 87e90a291..701154ffa 100644 --- a/files/materials/water.shader +++ b/files/materials/water.shader @@ -340,7 +340,7 @@ #if REFRACTION float3 refraction = shSample(refractionMap, (screenCoords-(normal.xy*REFR_BUMP))*1.0).rgb; - + // brighten up the refraction underwater refraction = (cameraPos.z < 0) ? shSaturate(refraction * 1.5) : refraction; #endif @@ -351,7 +351,7 @@ #if REFRACTION shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz; #else - shOutputColour(0).xyz = shLerp(reflection, float3(0.18039, 0.23137, 0.25490), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz; + shOutputColour(0).xyz = shLerp(reflection, float3(0.090195, 0.115685, 0.12745), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz; #endif // fog float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);