struct MeshMakeData;
class IGameDef;
+class IWritableTextureSource;
class IWritableToolDefManager;
class IWritableNodeDefManager;
#include "environment.h"
#include "settings.h"
#include <ICameraSceneNode.h>
+#include "serialization.h" // For decompressZlib
core::map<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
#include "mapnode.h"
#include "content_nodemeta.h"
#include "nodedef.h"
+#include "utility.h"
#define WATER_ALPHA 160
#include "inventory.h"
#include "content_mapnode.h"
#include "log.h"
+#include "utility.h"
/*
SignNodeMetadata
#include "settings.h"
#include "main.h" // For g_profiler
#include "profiler.h"
+#include "serialization.h" // For compressZlib
core::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;
*/
#include "farmesh.h"
+
#include "constants.h"
#include "debug.h"
#include "noise.h"
#include "map.h"
#include "client.h"
+#include "tile.h" // ITextureSource
-#include "mapgen.h"
+#include "mapgen.h" // Shouldn't really be done this way
FarMesh::FarMesh(
scene::ISceneNode* parent,
{
dstream<<__FUNCTION_NAME<<std::endl;
- video::IVideoDriver* driver = mgr->getVideoDriver();
+ //video::IVideoDriver* driver = mgr->getVideoDriver();
m_materials[0].setFlag(video::EMF_LIGHTING, false);
m_materials[0].setFlag(video::EMF_BACK_FACE_CULLING, true);
m_materials[1].setFlag(video::EMF_BACK_FACE_CULLING, false);
m_materials[1].setFlag(video::EMF_BILINEAR_FILTER, false);
m_materials[1].setFlag(video::EMF_FOG_ENABLE, false);
- m_materials[1].setTexture
- (0, driver->getTexture(getTexturePath("treeprop.png").c_str()));
+ m_materials[1].setTexture(0, client->tsrc()->getTextureRaw("treeprop.png"));
m_materials[1].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
m_materials[1].setFlag(video::EMF_FOG_ENABLE, true);
return std::string("current_player=") + c->current_player->getName();
}
+IMoveAction::IMoveAction(std::istream &is)
+{
+ std::string ts;
+
+ std::getline(is, ts, ' ');
+ count = stoi(ts);
+
+ std::getline(is, from_inv, ' ');
+
+ std::getline(is, from_list, ' ');
+
+ std::getline(is, ts, ' ');
+ from_i = stoi(ts);
+
+ std::getline(is, to_inv, ' ');
+
+ std::getline(is, to_list, ' ');
+
+ std::getline(is, ts, ' ');
+ to_i = stoi(ts);
+}
+
void IMoveAction::apply(InventoryContext *c, InventoryManager *mgr)
{
Inventory *inv_from = mgr->getInventory(c, from_inv);
from_i = -1;
to_i = -1;
}
- IMoveAction(std::istream &is)
- {
- std::string ts;
-
- std::getline(is, ts, ' ');
- count = stoi(ts);
-
- std::getline(is, from_inv, ' ');
-
- std::getline(is, from_list, ' ');
-
- std::getline(is, ts, ' ');
- from_i = stoi(ts);
-
- std::getline(is, to_inv, ' ');
-
- std::getline(is, to_list, ' ');
-
- std::getline(is, ts, ' ');
- to_i = stoi(ts);
- }
+
+ IMoveAction(std::istream &is);
u16 getType() const
{
#include "mapblock_nodemod.h"
#include "constants.h"
#include "voxel.h"
+#include "utility.h" // Needed for UniqueQueue, a member of Map
extern "C" {
#include "sqlite3.h"
#include "tile.h"
#include "gamedef.h"
#include "content_mapblock.h"
+#include "mineral.h" // For mineral_block_texture
void MeshMakeData::fill(u32 daynight_ratio, MapBlock *block)
{
dest.push_back(face);
}
+static TileSpec getTile(const MapNode &node, v3s16 dir,
+ ITextureSource *tsrc, INodeDefManager *nodemgr)
+{
+ const ContentFeatures &f = nodemgr->get(node);
+
+ if(f.param_type == CPT_FACEDIR_SIMPLE)
+ dir = facedir_rotate(node.param1, dir);
+
+ TileSpec spec;
+
+ s32 dir_i = -1;
+
+ if(dir == v3s16(0,0,0))
+ dir_i = -1;
+ else if(dir == v3s16(0,1,0))
+ dir_i = 0;
+ else if(dir == v3s16(0,-1,0))
+ dir_i = 1;
+ else if(dir == v3s16(1,0,0))
+ dir_i = 2;
+ else if(dir == v3s16(-1,0,0))
+ dir_i = 3;
+ else if(dir == v3s16(0,0,1))
+ dir_i = 4;
+ else if(dir == v3s16(0,0,-1))
+ dir_i = 5;
+
+ if(dir_i == -1)
+ // Non-directional
+ spec = f.tiles[0];
+ else
+ spec = f.tiles[dir_i];
+
+ /*
+ If it contains some mineral, change texture id
+ */
+ if(f.param_type == CPT_MINERAL && tsrc)
+ {
+ u8 mineral = node.getMineral(nodemgr);
+ std::string mineral_texture_name = mineral_block_texture(mineral);
+ if(mineral_texture_name != "")
+ {
+ u32 orig_id = spec.texture.id;
+ std::string texture_name = tsrc->getTextureName(orig_id);
+ //texture_name += "^blit:";
+ texture_name += "^";
+ texture_name += mineral_texture_name;
+ u32 new_id = tsrc->getTextureId(texture_name);
+ spec.texture = tsrc->getTexture(new_id);
+ }
+ }
+
+ return spec;
+}
+
/*
Gets node tile from any place relative to block.
Returns TILE_NODE if doesn't exist or should not be drawn.
NodeModMap &temp_mods, ITextureSource *tsrc, INodeDefManager *ndef)
{
TileSpec spec;
- spec = mn.getTile(face_dir, tsrc, ndef);
+ spec = getTile(mn, face_dir, tsrc, ndef);
/*
Check temporary modifications on this node
if(mod.type == NODEMOD_CHANGECONTENT)
{
MapNode mn2(mod.param);
- spec = mn2.getTile(face_dir, tsrc, ndef);
+ spec = getTile(mn2, face_dir, tsrc, ndef);
}
if(mod.type == NODEMOD_CRACK)
{
#include "main.h" // For g_settings
#include "nodedef.h"
#include "content_mapnode.h" // For mapnode_translate_*_internal
+#include "serialization.h" // For ser_ver_supported
#ifndef SERVER
/*
return (lightday&0x0f) | ((lightnight<<4)&0xf0);
}
-#ifndef SERVER
-TileSpec MapNode::getTile(v3s16 dir, ITextureSource *tsrc,
- INodeDefManager *nodemgr) const
-{
- if(nodemgr->get(*this).param_type == CPT_FACEDIR_SIMPLE)
- dir = facedir_rotate(param1, dir);
-
- TileSpec spec;
-
- s32 dir_i = -1;
-
- if(dir == v3s16(0,0,0))
- dir_i = -1;
- else if(dir == v3s16(0,1,0))
- dir_i = 0;
- else if(dir == v3s16(0,-1,0))
- dir_i = 1;
- else if(dir == v3s16(1,0,0))
- dir_i = 2;
- else if(dir == v3s16(-1,0,0))
- dir_i = 3;
- else if(dir == v3s16(0,0,1))
- dir_i = 4;
- else if(dir == v3s16(0,0,-1))
- dir_i = 5;
-
- if(dir_i == -1)
- // Non-directional
- spec = nodemgr->get(*this).tiles[0];
- else
- spec = nodemgr->get(*this).tiles[dir_i];
-
- /*
- If it contains some mineral, change texture id
- */
- if(nodemgr->get(*this).param_type == CPT_MINERAL && tsrc)
- {
- u8 mineral = getMineral(nodemgr);
- std::string mineral_texture_name = mineral_block_texture(mineral);
- if(mineral_texture_name != "")
- {
- u32 orig_id = spec.texture.id;
- std::string texture_name = tsrc->getTextureName(orig_id);
- //texture_name += "^blit:";
- texture_name += "^";
- texture_name += mineral_texture_name;
- u32 new_id = tsrc->getTextureId(texture_name);
- spec.texture = tsrc->getTexture(new_id);
- }
- }
-
- return spec;
-}
-#endif
-
u8 MapNode::getMineral(INodeDefManager *nodemgr) const
{
if(nodemgr->get(*this).param_type == CPT_MINERAL)
#ifndef MAPNODE_HEADER
#define MAPNODE_HEADER
-#include <iostream>
#include "irrlichttypes.h"
#include "light.h"
-#include "exceptions.h"
-#include "serialization.h"
-#ifndef SERVER
-#include "tile.h"
-#endif
class INodeDefManager;
return mix;
}*/
- // In mapnode.cpp
-#ifndef SERVER
- /*
- Get tile of a face of the node.
- dir: direction of face
- Returns: TileSpec. Can contain miscellaneous texture coordinates,
- which must be obeyed so that the texture atlas can be used.
- */
- TileSpec getTile(v3s16 dir, ITextureSource *tsrc,
- INodeDefManager *nodemgr) const;
-#endif
-
/*
Gets mineral content of node, if there is any.
MINERAL_NONE if doesn't contain or isn't able to contain mineral.
#endif
}
+v3s16 Player::getLightPosition() const
+{
+ return floatToInt(m_position + v3f(0,BS+BS/2,0), BS);
+}
+
void Player::serialize(std::ostream &os)
{
// Utilize a Settings object for storing values
return m_position;
}
- v3s16 getLightPosition() const
- {
- return floatToInt(m_position + v3f(0,BS+BS/2,0), BS);
- }
+ v3s16 getLightPosition() const;
v3f getEyeOffset()
{
#include "auth.h"
#include "ban.h"
#include "gamedef.h"
+#include "serialization.h" // For SER_FMT_VER_INVALID
struct LuaState;
typedef struct lua_State lua_State;
class IWritableToolDefManager;