From dcec9bafcfbaeedbb0014f90824e4bfc055c64bf Mon Sep 17 00:00:00 2001 From: hikerstk Date: Tue, 5 Jan 2010 03:38:35 +0000 Subject: [PATCH] Added support for irrlicht 1.7. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4400 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/irr_driver.cpp | 4 ++ src/graphics/material_manager.cpp | 4 ++ src/guiengine/skin.cpp | 13 ++++- src/guiengine/skin.hpp | 5 ++ src/ide/vc9/bullet_lib.vcproj | 64 ++++++++++++++++++++++ src/ide/vc9/enet.vcproj | 64 ++++++++++++++++++++++ src/ide/vc9/supertuxkart.sln | 7 +++ src/ide/vc9/supertuxkart.vcproj | 88 +++++++++++++++++++++++++++++++ src/tracks/track.cpp | 8 +++ 9 files changed, 256 insertions(+), 1 deletion(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 5913ee6f5..8179d24a7 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -344,7 +344,11 @@ scene::ISceneNode* IrrDriver::addWaterNode(scene::IMesh *mesh, */ scene::ISceneNode *IrrDriver::addOctTree(scene::IMesh *mesh) { +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR == 7) + return m_scene_manager->addOctreeSceneNode(mesh); +#else return m_scene_manager->addOctTreeSceneNode(mesh); +#endif } // addOctTree // ---------------------------------------------------------------------------- diff --git a/src/graphics/material_manager.cpp b/src/graphics/material_manager.cpp index 35c90c8ab..e7c8bc49b 100644 --- a/src/graphics/material_manager.cpp +++ b/src/graphics/material_manager.cpp @@ -50,7 +50,11 @@ MaterialManager::MaterialManager() void MaterialManager::setAllMaterialFlags(video::ITexture* t, scene::IMeshBuffer *mb) const { +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR == 7) + const std::string image = StringUtils::getBasename(core::stringc(t->getName()).c_str()); +#else const std::string image = StringUtils::getBasename(t->getName().c_str()); +#endif // Search backward so that temporary (track) textures are found first for(int i = (int)m_materials.size()-1; i>=0; i-- ) { diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index cb07ed60e..d79f259ee 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -1326,7 +1326,18 @@ void Skin::drawBGFadeColor() GUIEngine::getDriver()->getCurrentRenderTargetSize()) ); } -core::rect< s32 > Skin::draw3DWindowBackground (IGUIElement *element, bool drawTitleBar, video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip) +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR==7) +core::rect< s32 > Skin::draw3DWindowBackground(IGUIElement *element, bool drawTitleBar, + video::SColor titleBarColor, + const core::rect< s32 > &rect, + const core::rect< s32 > *clip, + core::rect* checkClientArea) +#else +core::rect< s32 > Skin::draw3DWindowBackground(IGUIElement *element, bool drawTitleBar, + video::SColor titleBarColor, + const core::rect< s32 > &rect, + const core::rect< s32 > *clip) +#endif { drawBGFadeColor(); diff --git a/src/guiengine/skin.hpp b/src/guiengine/skin.hpp index 1e576be7a..09ae66971 100644 --- a/src/guiengine/skin.hpp +++ b/src/guiengine/skin.hpp @@ -254,7 +254,12 @@ namespace GUIEngine virtual void draw3DTabBody (irr::gui::IGUIElement *element, bool border, bool background, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::s32 tabHeight=-1, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT); virtual void draw3DTabButton (irr::gui::IGUIElement *element, bool active, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT); virtual void draw3DToolBar (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR==7) + virtual irr::core::rect< irr::s32 > draw3DWindowBackground (irr::gui::IGUIElement *element, bool drawTitleBar, irr::video::SColor titleBarColor, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, + irr::core::rect* checkClientArea=0); +#else virtual irr::core::rect< irr::s32 > draw3DWindowBackground (irr::gui::IGUIElement *element, bool drawTitleBar, irr::video::SColor titleBarColor, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); +#endif virtual void drawIcon (irr::gui::IGUIElement *element, irr::gui::EGUI_DEFAULT_ICON icon, const irr::core::position2di position, irr::u32 starttime, irr::u32 currenttime, bool loop=false, const irr::core::rect< irr::s32 > *clip=NULL); virtual irr::video::SColor getColor (irr::gui::EGUI_DEFAULT_COLOR color) const; virtual const wchar_t* getDefaultText (irr::gui::EGUI_DEFAULT_TEXT text) const; diff --git a/src/ide/vc9/bullet_lib.vcproj b/src/ide/vc9/bullet_lib.vcproj index 39f42c626..d151f7d6f 100644 --- a/src/ide/vc9/bullet_lib.vcproj +++ b/src/ide/vc9/bullet_lib.vcproj @@ -209,6 +209,70 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ide/vc9/supertuxkart.sln b/src/ide/vc9/supertuxkart.sln index 02d31c42b..0faee7700 100644 --- a/src/ide/vc9/supertuxkart.sln +++ b/src/ide/vc9/supertuxkart.sln @@ -15,6 +15,7 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug|Win32 = debug|Win32 irr1.6|Win32 = irr1.6|Win32 + irr1.7|Win32 = irr1.7|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution @@ -22,18 +23,24 @@ Global {B1BC2764-1A43-4800-A654-788B0D05EDA2}.debug|Win32.Build.0 = Debug|Win32 {B1BC2764-1A43-4800-A654-788B0D05EDA2}.irr1.6|Win32.ActiveCfg = irr1.6|Win32 {B1BC2764-1A43-4800-A654-788B0D05EDA2}.irr1.6|Win32.Build.0 = irr1.6|Win32 + {B1BC2764-1A43-4800-A654-788B0D05EDA2}.irr1.7|Win32.ActiveCfg = irr1.7|Win32 + {B1BC2764-1A43-4800-A654-788B0D05EDA2}.irr1.7|Win32.Build.0 = irr1.7|Win32 {B1BC2764-1A43-4800-A654-788B0D05EDA2}.Release|Win32.ActiveCfg = Release|Win32 {B1BC2764-1A43-4800-A654-788B0D05EDA2}.Release|Win32.Build.0 = Release|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.debug|Win32.ActiveCfg = Release|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.debug|Win32.Build.0 = Release|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.irr1.6|Win32.ActiveCfg = irr1.6|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.irr1.6|Win32.Build.0 = irr1.6|Win32 + {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.irr1.7|Win32.ActiveCfg = irr1.7|Win32 + {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.irr1.7|Win32.Build.0 = irr1.7|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.Release|Win32.ActiveCfg = Release|Win32 {54AA44B9-B07B-49DA-8B1A-05BBFE8AD5D4}.Release|Win32.Build.0 = Release|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.debug|Win32.ActiveCfg = Release|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.debug|Win32.Build.0 = Release|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.irr1.6|Win32.ActiveCfg = irr1.6|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.irr1.6|Win32.Build.0 = irr1.6|Win32 + {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.irr1.7|Win32.ActiveCfg = irr1.7|Win32 + {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.irr1.7|Win32.Build.0 = irr1.7|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.Release|Win32.ActiveCfg = Release|Win32 {B0E92B97-089A-4D5B-BF17-77F1BC5DAEEF}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection diff --git a/src/ide/vc9/supertuxkart.vcproj b/src/ide/vc9/supertuxkart.vcproj index 82a837877..9656e8248 100644 --- a/src/ide/vc9/supertuxkart.vcproj +++ b/src/ide/vc9/supertuxkart.vcproj @@ -272,6 +272,94 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index a04c11304..bdc4ba996 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -371,7 +371,11 @@ void Track::convertTrackToBullet(const scene::IMesh *mesh, const Material* material=0; TriangleMesh *tmesh = m_track_mesh; if(t) { +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR == 7) + std::string image = std::string(core::stringc(t->getName()).c_str()); +#else std::string image = std::string(t->getName().c_str()); +#endif material=material_manager->getMaterial(StringUtils::getBasename(image)); // Zipper are converted to non-collision mesh, since otherwise // the road becomes 'bumpy' if the meshes are not 100% correctly @@ -515,7 +519,11 @@ void Track::handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml) video::ITexture* t=irrMaterial.getTexture(j); if(!t) continue; const std::string texture_name = +#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR == 7) + StringUtils::getBasename(core::stringc(t->getName()).c_str()); +#else StringUtils::getBasename(t->getName().c_str()); +#endif if(texture_name!=name) continue; core::matrix4 *m = &irrMaterial.getTextureMatrix(j); m_animated_textures.push_back(new MovingTexture(m, *texture_node));