]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/inventory.h
still a missing file
[dragonfireclient.git] / src / inventory.h
index 84ccd5bd6306c19007a515f50a1f0f473ae49422..9155eb025f5868d34acecfaf4e7fc43cfa33925a 100644 (file)
@@ -122,16 +122,8 @@ class MaterialItem : public InventoryItem
 #ifndef SERVER
        video::ITexture * getImage()
        {
-               /*if(m_content == CONTENT_TORCH)
-                       return g_texturecache.get("torch_on_floor");
-
-               u16 tile = content_tile(m_content, v3s16(1,0,0));
-               return g_tile_contents[tile].getTexture(0);*/
-               
-               if(m_content >= USEFUL_CONTENT_COUNT)
-                       return NULL;
-                       
-               return g_irrlicht->getTexture(g_content_inventory_texture_paths[m_content]);
+               return content_features(m_content).inventory_texture;
+               return NULL;
        }
 #endif
        std::string getText()
@@ -256,16 +248,23 @@ class CraftItem : public InventoryItem
 #ifndef SERVER
        video::ITexture * getImage()
        {
-               std::string basename;
+               if(g_texturesource == NULL)
+                       return NULL;
+               
+               std::string name;
+
                if(m_subname == "Stick")
-                       basename = porting::getDataPath("stick.png").c_str();
-               // Default to cloud texture
+                       name = "stick.png";
+               else if(m_subname == "lump_of_coal")
+                       name = "lump_of_coal.png";
+               else if(m_subname == "lump_of_iron")
+                       name = "lump_of_iron.png";
                else
-                       basename = tile_texture_path_get(TILE_CLOUD);
+                       name = "cloud.png";
                
                // Get such a texture
-               return g_irrlicht->getTexture(basename);
-               //return g_irrlicht->getTexture(TextureSpec(finalname, basename, mod));
+               //return g_irrlicht->getTexture(name);
+               return g_texturesource->getTextureRaw(name);
        }
 #endif
        std::string getText()
@@ -331,34 +330,36 @@ class ToolItem : public InventoryItem
 #ifndef SERVER
        video::ITexture * getImage()
        {
+               if(g_texturesource == NULL)
+                       return NULL;
+               
                std::string basename;
                if(m_toolname == "WPick")
-                       basename = porting::getDataPath("tool_wpick.png").c_str();
+                       basename = "tool_wpick.png";
                else if(m_toolname == "STPick")
-                       basename = porting::getDataPath("tool_stpick.png").c_str();
+                       basename = "tool_stpick.png";
                else if(m_toolname == "MesePick")
-                       basename = porting::getDataPath("tool_mesepick.png").c_str();
-               // Default to cloud texture
+                       basename = "tool_mesepick.png";
                else
-                       basename = tile_texture_path_get(TILE_CLOUD);
+                       basename = "cloud.png";
                
                /*
-                       Calculate some progress value with sane amount of
+                       Calculate a progress value with sane amount of
                        maximum states
                */
                u32 maxprogress = 30;
                u32 toolprogress = (65535-m_wear)/(65535/maxprogress);
                
-               // Make texture name for the new texture with a progress bar
+               float value_f = (float)toolprogress / (float)maxprogress;
                std::ostringstream os;
-               os<<basename<<"-toolprogress-"<<toolprogress;
-               std::string finalname = os.str();
+               os<<basename<<"^[progressbar"<<value_f;
 
-               float value_f = (float)toolprogress / (float)maxprogress;
-               
-               // Get such a texture
-               TextureMod *mod = new ProgressBarTextureMod(value_f);
-               return g_irrlicht->getTexture(TextureSpec(finalname, basename, mod));
+               return g_texturesource->getTextureRaw(os.str());
+
+               /*TextureSpec spec;
+               spec.addTid(g_irrlicht->getTextureId(basename));
+               spec.addTid(g_irrlicht->getTextureId(os.str()));
+               return g_irrlicht->getTexture(spec);*/
        }
 #endif
        std::string getText()