]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_cso.cpp
Replace instance of readsome with read in decompressZlib Make decompressZlib more...
[dragonfireclient.git] / src / content_cso.cpp
index ce6ce0a21235c9a7d38116218c1444ac89c2ef7d..0790024fc9623f0319ac3523ae5c9d96452f4851 100644 (file)
@@ -1,29 +1,31 @@
 /*
-Minetest-c55
-Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
 #include "content_cso.h"
 #include <IBillboardSceneNode.h>
-#include "tile.h"
+#include "client/tile.h"
 #include "environment.h"
 #include "gamedef.h"
 #include "log.h"
+#include "map.h"
 
+/*
 static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill,
                float txs, float tys, int col, int row)
 {
@@ -32,6 +34,7 @@ static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill,
        matrix.setTextureTranslate(txs*col, tys*row);
        matrix.setTextureScale(txs, tys);
 }
+*/
 
 class SmokePuffCSO: public ClientSimpleObject
 {
@@ -47,7 +50,7 @@ class SmokePuffCSO: public ClientSimpleObject
                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);
@@ -57,13 +60,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);
        }