summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-01-28 01:38:16 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-01-28 01:38:16 +0200
commit64b59757322e29c331c0a75262baec4382673e6f (patch)
treeb1404f42db92b92202655bdd4f13a6c4c7fdd39d /src/inventory.h
parentbd100c5483eb77a27eeac4e476c81a1bf6afc710 (diff)
downloadminetest-64b59757322e29c331c0a75262baec4382673e6f.tar.gz
minetest-64b59757322e29c331c0a75262baec4382673e6f.tar.bz2
minetest-64b59757322e29c331c0a75262baec4382673e6f.zip
Now texture handling is fast. Also now players are saved on disk.
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 797a67509..e7c7adaee 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -122,10 +122,12 @@ public:
#ifndef SERVER
video::ITexture * getImage()
{
- if(m_content >= USEFUL_CONTENT_COUNT)
+ /*if(m_content >= USEFUL_CONTENT_COUNT)
return NULL;
- return g_irrlicht->getTexture(g_content_inventory_texture_paths[m_content]);
+ return g_irrlicht->getTexture(g_content_inventory_texture_paths[m_content]);*/
+
+ return g_irrlicht->getTexture(content_features(m_content).inventory_texture);
}
#endif
std::string getText()
@@ -250,19 +252,19 @@ public:
#ifndef SERVER
video::ITexture * getImage()
{
- std::string basename;
+ std::string name;
if(m_subname == "Stick")
- basename = porting::getDataPath("stick.png");
+ name = "stick.png";
else if(m_subname == "lump_of_coal")
- basename = porting::getDataPath("lump_of_coal.png");
+ name = "lump_of_coal.png";
else if(m_subname == "lump_of_iron")
- basename = porting::getDataPath("lump_of_iron.png");
+ name = "lump_of_iron.png";
else
- basename = porting::getDataPath("cloud.png[[mod:crack3");
+ name = "cloud.png";
// Get such a texture
- return g_irrlicht->getTexture(basename);
+ return g_irrlicht->getTexture(name);
}
#endif
std::string getText()
@@ -330,28 +332,35 @@ public:
{
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 = porting::getDataPath("cloud.png").c_str();
- //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<<"[progressbar"<<value_f;
+
+ TextureSpec spec;
+ spec.addTid(g_irrlicht->getTextureId(basename));
+ spec.addTid(g_irrlicht->getTextureId(os.str()));
+ return g_irrlicht->getTexture(spec);
+
+ /*// Make texture name for the new texture with a progress bar
float value_f = (float)toolprogress / (float)maxprogress;
std::ostringstream os;
os<<basename<<"[[mod:progressbar"<<value_f;
- return g_irrlicht->getTexture(os.str());
+ return g_irrlicht->getTexture(os.str());*/
/*// Make texture name for the new texture with a progress bar
std::ostringstream os;