]> git.lizzy.rs Git - minetest.git/blobdiff - src/camera.cpp
Random Lua tweaks/fixes
[minetest.git] / src / camera.cpp
index d001f8916bac1701d1b8930711ef68552d1f6e2a..54b3326fa73da203666b54da9285ddf33f0e67df 100644 (file)
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <cmath>
 #include <SAnimatedMesh.h>
 #include "settings.h"
-#include "mapnode_contentfeatures.h" // For wield visualization
+#include "nodedef.h" // For wield visualization
 
 Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control):
        m_smgr(smgr),
@@ -449,8 +449,11 @@ void Camera::updateSettings()
        m_wanted_frametime = 1.0 / wanted_fps;
 }
 
-void Camera::wield(const InventoryItem* item, ITextureSource *tsrc)
+void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
 {
+       //ITextureSource *tsrc = gamedef->tsrc();
+       INodeDefManager *ndef = gamedef->ndef();
+
        if (item != NULL)
        {
                bool isCube = false;
@@ -461,18 +464,26 @@ void Camera::wield(const InventoryItem* item, ITextureSource *tsrc)
                        // A block-type material
                        MaterialItem* mat_item = (MaterialItem*) item;
                        content_t content = mat_item->getMaterial();
-                       if (content_features(content).solidness || content_features(content).visual_solidness)
-                       {
-                               m_wieldnode->setCube(content_features(content).tiles);
+                       switch(ndef->get(content).drawtype){
+                       case NDT_NORMAL:
+                       case NDT_LIQUID:
+                       case NDT_FLOWINGLIQUID:
+                       case NDT_GLASSLIKE:
+                       case NDT_ALLFACES:
+                       case NDT_ALLFACES_OPTIONAL:
+                               m_wieldnode->setCube(ndef->get(content).tiles);
                                m_wieldnode->setScale(v3f(30));
                                isCube = true;
+                               break;
+                       default:
+                               break;
                        }
                }
 
                // If that failed, make an extruded sprite.
                if (!isCube)
                {
-                       m_wieldnode->setSprite(item->getImageRaw(tsrc));
+                       m_wieldnode->setSprite(item->getImageRaw());
                        m_wieldnode->setScale(v3f(40));
                }