]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_cao.cpp
Move globals from main.cpp to more sane locations
[dragonfireclient.git] / src / content_cao.cpp
index 4994c8b201ab6d66b102f02b4ce1ed59ca8aaf94..a8b107b49692630eec80667ea04ae4b457f1fe83 100644 (file)
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/numeric.h" // For IntervalLimiter
 #include "util/serialize.h"
 #include "util/mathconstants.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "environment.h"
 #include "collision.h"
 #include "settings.h"
@@ -42,7 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodedef.h"
 #include "localplayer.h"
 #include "map.h"
-#include "main.h" // g_settings
 #include "camera.h" // CameraModes
 #include "wieldmesh.h"
 #include "log.h"
@@ -211,7 +210,7 @@ void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
        // Set material
        buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
        buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
-       buf->getMaterial().setTexture(0, tsrc->getTexture("rat.png"));
+       buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
        buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
        buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
        buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
@@ -822,7 +821,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
                                NULL, v2f(1, 1), v3f(0,0,0), -1);
                m_spritenode->grab();
                m_spritenode->setMaterialTexture(0,
-                               tsrc->getTexture("unknown_node.png"));
+                               tsrc->getTextureForMesh("unknown_node.png"));
                m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
                m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
                m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
@@ -962,7 +961,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
                // Add a text node for showing the name
                gui::IGUIEnvironment* gui = irr->getGUIEnvironment();
                std::wstring wname = narrow_to_wide(m_name);
-               m_textnode = smgr->addTextSceneNode(gui->getBuiltInFont(),
+               m_textnode = smgr->addTextSceneNode(gui->getSkin()->getFont(),
                                wname.c_str(), video::SColor(255,255,255,255), node);
                m_textnode->grab();
                m_textnode->setPosition(v3f(0, BS*1.1, 0));
@@ -1299,7 +1298,7 @@ void GenericCAO::updateTextures(const std::string &mod)
                                texturestring = m_prop.textures[0];
                        texturestring += mod;
                        m_spritenode->setMaterialTexture(0,
-                                       tsrc->getTexture(texturestring));
+                                       tsrc->getTextureForMesh(texturestring));
 
                        // This allows setting per-material colors. However, until a real lighting
                        // system is added, the code below will have no effect. Once MineTest
@@ -1327,7 +1326,7 @@ void GenericCAO::updateTextures(const std::string &mod)
                                if(texturestring == "")
                                        continue; // Empty texture string means don't modify that material
                                texturestring += mod;
-                               video::ITexture* texture = tsrc->getTexture(texturestring);
+                               video::ITexture* texture = tsrc->getTextureForMesh(texturestring);
                                if(!texture)
                                {
                                        errorstream<<"GenericCAO::updateTextures(): Could not load texture "<<texturestring<<std::endl;
@@ -1376,7 +1375,7 @@ void GenericCAO::updateTextures(const std::string &mod)
                                material.setFlag(video::EMF_LIGHTING, false);
                                material.setFlag(video::EMF_BILINEAR_FILTER, false);
                                material.setTexture(0,
-                                               tsrc->getTexture(texturestring));
+                                               tsrc->getTextureForMesh(texturestring));
                                material.getTextureMatrix(0).makeIdentity();
 
                                // This allows setting per-material colors. However, until a real lighting
@@ -1404,7 +1403,7 @@ void GenericCAO::updateTextures(const std::string &mod)
                                tname += mod;
                                scene::IMeshBuffer *buf = mesh->getMeshBuffer(0);
                                buf->getMaterial().setTexture(0,
-                                               tsrc->getTexture(tname));
+                                               tsrc->getTextureForMesh(tname));
 
                                // This allows setting per-material colors. However, until a real lighting
                                // system is added, the code below will have no effect. Once MineTest
@@ -1429,7 +1428,7 @@ void GenericCAO::updateTextures(const std::string &mod)
                                tname += mod;
                                scene::IMeshBuffer *buf = mesh->getMeshBuffer(1);
                                buf->getMaterial().setTexture(0,
-                                               tsrc->getTexture(tname));
+                                               tsrc->getTextureForMesh(tname));
 
                                // This allows setting per-material colors. However, until a real lighting
                                // system is added, the code below will have no effect. Once MineTest
@@ -1718,10 +1717,12 @@ void GenericCAO::processMessage(const std::string &data)
        }
 }
        
+/* \pre punchitem != NULL
+ */
 bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem,
                float time_from_last_punch)
 {
-       assert(punchitem);
+       assert(punchitem);      // pre-condition
        const ToolCapabilities *toolcap =
                        &punchitem->getToolCapabilities(m_gamedef->idef());
        PunchDamageResult result = getPunchDamage(