From 3d1c481f0bdf03b59871237d810685278e87613b Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 22 Nov 2012 21:01:31 +0200 Subject: RealBadAngel's patch which allows the lua api to read pressed player keys. This should make it possible to change the player's animation based on what he is doing Correct lua api version number Always update animations and attachments after the entity is added to scene client side. Fixes animations not being applied in client initialization for some reason. Attachments should be re-tested now just to be safe. Fix a segmentation fault caused by reaching materials that didn't exist in a loop for setting texture --- src/content_cao.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/content_cao.cpp') diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 9c1171e1f..339c9f248 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -970,8 +970,11 @@ public: wname.c_str(), video::SColor(255,255,255,255), node); m_textnode->setPosition(v3f(0, BS*1.1, 0)); } - + updateNodePos(); + updateAnimation(); + updateBonePosition(); + updateAttachments(); } void expireVisuals() @@ -1049,9 +1052,6 @@ public: removeFromScene(false); addToScene(m_smgr, m_gamedef->tsrc(), m_irr); - updateAnimation(); - updateBonePosition(); - updateAttachments(); // Attachments, part 2: Now that the parent has been refreshed, put its attachments back for(std::vector >::iterator ii = m_env->attachment_list.begin(); ii != m_env->attachment_list.end(); ii++) @@ -1248,7 +1248,7 @@ public: { if(m_prop.visual == "mesh") { - for (u32 i = 0; i < m_prop.textures.size(); ++i) + for (u32 i = 0; i < m_prop.textures.size() && i < m_animated_meshnode->getMaterialCount(); ++i) { std::string texturestring = m_prop.textures[i]; if(texturestring == "") @@ -1271,7 +1271,7 @@ public: m_animated_meshnode->getMaterial(i).setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter); m_animated_meshnode->getMaterial(i).setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter); } - for (u32 i = 0; i < m_prop.colors.size(); ++i) + for (u32 i = 0; i < m_prop.colors.size() && i < m_animated_meshnode->getMaterialCount(); ++i) { // This allows setting per-material colors. However, until a real lighting // system is added, the code below will have no effect. Once MineTest -- cgit v1.2.3