Permalink
Browse files

Fix more issues on feature unlocked screen

  • Loading branch information...
1 parent bc83bb1 commit 6a4e46af5cdea27abb1fe06851f65402dcbc042c @auriamg auriamg committed Jun 17, 2014
Showing with 30 additions and 5 deletions.
  1. +27 −5 src/states_screens/feature_unlocked.cpp
  2. +3 −0 src/states_screens/feature_unlocked.hpp
@@ -319,7 +319,7 @@ void FeatureUnlockedCutScene::init()
else if (!m_unlocked_stuff[n].m_pictures.empty())
{
video::SMaterial m;
- m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
+ //m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
m.BackfaceCulling = false;
m.setTexture(0, m_unlocked_stuff[n].m_pictures[0]);
m.AmbientColor = video::SColor(255, 255, 255, 255);
@@ -335,8 +335,16 @@ void FeatureUnlockedCutScene::init()
irr_driver->createTexturedQuadMesh(&m,
m_unlocked_stuff[n].m_w,
m_unlocked_stuff[n].m_h);
- m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh(mesh);
- mesh->drop();
+ m_unlocked_stuff[n].m_root_gift_node = irr_driver->getSceneManager()->addEmptySceneNode();
+ m_unlocked_stuff[n].m_side_1 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node);
+ //mesh->drop();
+
+ mesh = irr_driver->createTexturedQuadMesh(&m,
+ m_unlocked_stuff[n].m_w,
+ m_unlocked_stuff[n].m_h);
+ m_unlocked_stuff[n].m_side_2 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node);
+ m_unlocked_stuff[n].m_side_2->setRotation(core::vector3df(0.0f, 180.0f, 0.0f));
+ //mesh->drop();
#ifdef DEBUG
m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture");
#endif
@@ -432,7 +440,7 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
if (textureID != previousTextureID)
{
scene::IMeshSceneNode* node = (scene::IMeshSceneNode*)m_unlocked_stuff[n].m_root_gift_node;
- scene::IMesh* mesh = node->getMesh();
+ scene::IMesh* mesh = m_unlocked_stuff[n].m_side_1->getMesh();
assert(mesh->getMeshBufferCount() == 1);
@@ -443,7 +451,21 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
// FIXME: this mesh is already associated with this node. I'm calling this
// to force irrLicht to refresh the display, now that Material has changed.
- node->setMesh(mesh);
+ m_unlocked_stuff[n].m_side_1->setMesh(mesh);
+
+ m_unlocked_stuff[n].m_curr_image = textureID;
+
+
+ mesh = m_unlocked_stuff[n].m_side_2->getMesh();
+ assert(mesh->getMeshBufferCount() == 1);
+ mb = mesh->getMeshBuffer(0);
+
+ SMaterial& m2 = mb->getMaterial();
+ m2.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
+
+ // FIXME: this mesh is already associated with this node. I'm calling this
+ // to force irrLicht to refresh the display, now that Material has changed.
+ m_unlocked_stuff[n].m_side_2->setMesh(mesh);
m_unlocked_stuff[n].m_curr_image = textureID;
} // textureID != previousTextureID
@@ -60,6 +60,9 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
/** Contains whatever is in the chest */
scene::ISceneNode* m_root_gift_node;
+ scene::IMeshSceneNode* m_side_1;
+ scene::IMeshSceneNode* m_side_2;
+
float m_scale;
irr::core::stringw m_unlock_message;

0 comments on commit 6a4e46a

Please sign in to comment.