]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_cso.cpp
Turn off verbose info message introduced accidentally with ae9b1aa
[dragonfireclient.git] / src / content_cso.cpp
index 73d5f2b480f47d3e181f9cabc55a02c4ba70b8b4..04c503f44de72bd959b2a64e4b4d84b5249b699d 100644 (file)
@@ -19,38 +19,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "content_cso.h"
 #include <IBillboardSceneNode.h>
-#include "tile.h"
-#include "environment.h"
-#include "gamedef.h"
-#include "log.h"
+#include "client/tile.h"
+#include "clientenvironment.h"
+#include "client.h"
 #include "map.h"
 
-/*
-static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill,
-               float txs, float tys, int col, int row)
-{
-       video::SMaterial& material = bill->getMaterial(0);
-       core::matrix4& matrix = material.getTextureMatrix(0);
-       matrix.setTextureTranslate(txs*col, tys*row);
-       matrix.setTextureScale(txs, tys);
-}
-*/
-
 class SmokePuffCSO: public ClientSimpleObject
 {
-       float m_age;
-       scene::IBillboardSceneNode *m_spritenode;
+       float m_age = 0.0f;
+       scene::IBillboardSceneNode *m_spritenode = nullptr;
 public:
        SmokePuffCSO(scene::ISceneManager *smgr,
-                       ClientEnvironment *env, v3f pos, v2f size):
-               m_age(0),
-               m_spritenode(NULL)
+                       ClientEnvironment *env, const v3f &pos, const v2f &size)
        {
                infostream<<"SmokePuffCSO: constructing"<<std::endl;
                m_spritenode = smgr->addBillboardSceneNode(
                                NULL, v2f(1,1), pos, -1);
                m_spritenode->setMaterialTexture(0,
-                               env->getGameDef()->tsrc()->getTextureRaw("smoke_puff.png"));
+                               env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png"));
                m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
                m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
                //m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
@@ -60,13 +46,12 @@ class SmokePuffCSO: public ClientSimpleObject
                m_spritenode->setVisible(true);
                m_spritenode->setSize(size);
                /* Update brightness */
-               u8 light = 64;
-               try{
-                       MapNode n = env->getMap().getNode(floatToInt(pos, BS));
-                       light = decode_light(n.getLightBlend(env->getDayNightRatio(),
-                                       env->getGameDef()->ndef()));
-               }
-               catch(InvalidPositionException &e){}
+               u8 light;
+               bool pos_ok;
+               MapNode n = env->getMap().getNodeNoEx(floatToInt(pos, BS), &pos_ok);
+               light = pos_ok ? decode_light(n.getLightBlend(env->getDayNightRatio(),
+                                                       env->getGameDef()->ndef()))
+                              : 64;
                video::SColor color(255,light,light,light);
                m_spritenode->setColor(color);
        }