diff options
author | MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com> | 2012-11-22 21:01:31 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-11-25 19:14:24 +0200 |
commit | 3d1c481f0bdf03b59871237d810685278e87613b (patch) | |
tree | fe49c10e926b1e452e4f98561a148e2f145c27e9 /src/content_cao.cpp | |
parent | 756db8174aa6a05eb998cfcec8eb5127053c5ea9 (diff) | |
download | minetest-3d1c481f0bdf03b59871237d810685278e87613b.tar.gz minetest-3d1c481f0bdf03b59871237d810685278e87613b.tar.bz2 minetest-3d1c481f0bdf03b59871237d810685278e87613b.zip |
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
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<core::vector2d<int> >::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 |