Merge remote branch 'origin/master'

This commit is contained in:
Weblate 2013-01-24 15:56:49 +01:00
commit 13358c29b8
9 changed files with 188 additions and 84 deletions

@ -1098,7 +1098,9 @@ treedef={
Key for Special L-System Symbols used in Axioms Key for Special L-System Symbols used in Axioms
G - move forward one unit with the pen up G - move forward one unit with the pen up
F - move forward one unit with the pen down drawing trunks and branches F - move forward one unit with the pen down drawing trunks and branches
f - move forward one unit with the pen down drawing leaves f - move forward one unit with the pen down drawing leaves (100% chance)
T - move forward one unit with the pen down drawing trunks only
R - move forward one unit with the pen down placing fruit
A - replace with rules set A A - replace with rules set A
B - replace with rules set B B - replace with rules set B
C - replace with rules set C C - replace with rules set C

@ -69,15 +69,13 @@ GUIConfigureWorld::GUIConfigureWorld(gui::IGUIEnvironment* env,
m_worldmods = flattenModTree(getModsInPath(worldmods_path)); m_worldmods = flattenModTree(getModsInPath(worldmods_path));
// fill m_addontree with add-on mods // fill m_addontree with add-on mods
ModSpec addons("Add-Ons");
std::set<std::string> paths = m_gspec.addon_mods_paths; std::set<std::string> paths = m_gspec.addon_mods_paths;
for(std::set<std::string>::iterator it=paths.begin(); for(std::set<std::string>::iterator it=paths.begin();
it != paths.end(); ++it) it != paths.end(); ++it)
{ {
std::map<std::string,ModSpec> mods = getModsInPath(*it); std::map<std::string,ModSpec> mods = getModsInPath(*it);
addons.modpack_content.insert(mods.begin(), mods.end()); m_addontree.insert(mods.begin(), mods.end());
} }
m_addontree.insert(std::make_pair(addons.name,addons));
// expand modpacks // expand modpacks
m_addonmods = flattenModTree(m_addontree); m_addonmods = flattenModTree(m_addontree);
@ -116,7 +114,7 @@ GUIConfigureWorld::GUIConfigureWorld(gui::IGUIEnvironment* env,
ModSpec mod = (*it).second; ModSpec mod = (*it).second;
// a mod is new if it is not a modpack, and does not occur in // a mod is new if it is not a modpack, and does not occur in
// mod_names // mod_names
if(mod.modpack_content.empty() && if(!mod.is_modpack &&
mod_names.count(modname) == 0) mod_names.count(modname) == 0)
m_new_mod_names.insert(modname); m_new_mod_names.insert(modname);
} }
@ -253,7 +251,9 @@ void GUIConfigureWorld::regenerateGui(v2u32 screensize)
rect += v2s32(220, 0) + topleft; rect += v2s32(220, 0) + topleft;
m_treeview = Environment->addTreeView(rect, this, m_treeview = Environment->addTreeView(rect, this,
GUI_ID_MOD_TREEVIEW,true); GUI_ID_MOD_TREEVIEW,true);
buildTreeView(m_addontree, m_treeview->getRoot()); gui::IGUITreeViewNode* node
= m_treeview->getRoot()->addChildBack(L"Add-Ons");
buildTreeView(m_addontree, node);
} }
{ {
core::rect<s32> rect(0, 0, 120, 30); core::rect<s32> rect(0, 0, 120, 30);
@ -407,7 +407,11 @@ bool GUIConfigureWorld::OnEvent(const SEvent& event)
return true; return true;
} }
case GUI_ID_ENABLEALL: { case GUI_ID_ENABLEALL: {
if(selected_node != NULL && selected_node->getText() != NULL) if(selected_node != NULL && selected_node->getParent() == m_treeview->getRoot())
{
enableAllMods(m_addonmods,true);
}
else if(selected_node != NULL && selected_node->getText() != NULL)
{ {
std::string modname = wide_to_narrow(selected_node->getText()); std::string modname = wide_to_narrow(selected_node->getText());
ModSpec mod = m_addonmods[modname]; ModSpec mod = m_addonmods[modname];
@ -416,6 +420,10 @@ bool GUIConfigureWorld::OnEvent(const SEvent& event)
return true; return true;
} }
case GUI_ID_DISABLEALL: { case GUI_ID_DISABLEALL: {
if(selected_node != NULL && selected_node->getParent() == m_treeview->getRoot())
{
enableAllMods(m_addonmods,false);
}
if(selected_node != NULL && selected_node->getText() != NULL) if(selected_node != NULL && selected_node->getText() != NULL)
{ {
std::string modname = wide_to_narrow(selected_node->getText()); std::string modname = wide_to_narrow(selected_node->getText());
@ -517,7 +525,7 @@ void GUIConfigureWorld::buildTreeView(std::map<std::string, ModSpec> mods,
gui::IGUITreeViewNode* new_node = gui::IGUITreeViewNode* new_node =
node->addChildBack(narrow_to_wide(modname).c_str()); node->addChildBack(narrow_to_wide(modname).c_str());
m_nodes.insert(std::make_pair(modname, new_node)); m_nodes.insert(std::make_pair(modname, new_node));
if(!mod.modpack_content.empty()) if(mod.is_modpack)
buildTreeView(mod.modpack_content, new_node); buildTreeView(mod.modpack_content, new_node);
else else
{ {
@ -552,9 +560,19 @@ void GUIConfigureWorld::adjustSidebar()
modname_w = L"N/A"; modname_w = L"N/A";
std::string modname = wide_to_narrow(modname_w); std::string modname = wide_to_narrow(modname_w);
// if no mods installed, don't show buttons or checkbox on the sidebar
if(node->getParent() == m_treeview->getRoot() && !node->hasChilds())
{
m_disableall->setVisible(false);
m_enableall->setVisible(false);
m_enabled_checkbox->setVisible(false);
}
else
{
// if modpack, show enable/disable all buttons. otherwise, show // if modpack, show enable/disable all buttons. otherwise, show
// enabled checkbox // enabled checkbox
if(node->hasChilds()) if(node->getParent() == m_treeview->getRoot() ||
m_addonmods[modname].is_modpack)
{ {
m_enabled_checkbox->setVisible(false); m_enabled_checkbox->setVisible(false);
m_disableall->setVisible(true); m_disableall->setVisible(true);
@ -568,7 +586,7 @@ void GUIConfigureWorld::adjustSidebar()
m_enabled_checkbox->setVisible(true); m_enabled_checkbox->setVisible(true);
m_modname_text->setText((L"Mod: "+modname_w).c_str()); m_modname_text->setText((L"Mod: "+modname_w).c_str());
} }
}
// the mod is enabled unless it is disabled in the world.mt settings. // the mod is enabled unless it is disabled in the world.mt settings.
bool mod_enabled = true; bool mod_enabled = true;
if(m_settings.exists("load_mod_"+modname)) if(m_settings.exists("load_mod_"+modname))
@ -616,7 +634,7 @@ void GUIConfigureWorld::enableAllMods(std::map<std::string, ModSpec> mods,bool e
it != mods.end(); ++it) it != mods.end(); ++it)
{ {
ModSpec mod = (*it).second; ModSpec mod = (*it).second;
if(!mod.modpack_content.empty()) if(mod.is_modpack)
// a modpack, recursively enable all mods in it // a modpack, recursively enable all mods in it
enableAllMods(mod.modpack_content,enable); enableAllMods(mod.modpack_content,enable);
else // not a modpack else // not a modpack

@ -1048,12 +1048,12 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
GUIConfigureWorld *menu = new GUIConfigureWorld(env, parent, GUIConfigureWorld *menu = new GUIConfigureWorld(env, parent,
-1, menumgr, wspec); -1, menumgr, wspec);
menu->drop(); menu->drop();
return true;
} }
return true;
} }
case GUI_ID_SERVERLIST_DELETE: { case GUI_ID_SERVERLIST_DELETE: {
gui::IGUIListBox *serverlist = (gui::IGUIListBox*)getElementFromId(GUI_ID_SERVERLIST); gui::IGUIListBox *serverlist = (gui::IGUIListBox*)getElementFromId(GUI_ID_SERVERLIST);
u16 selected = ((gui::IGUIListBox*)serverlist)->getSelected(); s32 selected = ((gui::IGUIListBox*)serverlist)->getSelected();
if (selected == -1) return true; if (selected == -1) return true;
ServerList::deleteEntry(m_data->servers[selected]); ServerList::deleteEntry(m_data->servers[selected]);
m_data->servers = ServerList::getLocal(); m_data->servers = ServerList::getLocal();

@ -46,6 +46,7 @@ std::map<std::string, ModSpec> getModsInPath(std::string path)
modpack_is.close(); // We don't actually need the file modpack_is.close(); // We don't actually need the file
ModSpec spec(modname,modpath); ModSpec spec(modname,modpath);
spec.modpack_content = getModsInPath(modpath); spec.modpack_content = getModsInPath(modpath);
spec.is_modpack = true;
result.insert(std::make_pair(modname,spec)); result.insert(std::make_pair(modname,spec));
} }
else // not a modpack, add the modspec else // not a modpack, add the modspec
@ -76,7 +77,7 @@ std::map<std::string, ModSpec> flattenModTree(std::map<std::string, ModSpec> mod
it != mods.end(); ++it) it != mods.end(); ++it)
{ {
ModSpec mod = (*it).second; ModSpec mod = (*it).second;
if(!mod.modpack_content.empty()) //is a modpack if(mod.is_modpack)
{ {
std::map<std::string, ModSpec> content = std::map<std::string, ModSpec> content =
flattenModTree(mod.modpack_content); flattenModTree(mod.modpack_content);
@ -98,7 +99,7 @@ std::vector<ModSpec> flattenMods(std::map<std::string, ModSpec> mods)
it != mods.end(); ++it) it != mods.end(); ++it)
{ {
ModSpec mod = (*it).second; ModSpec mod = (*it).second;
if(!mod.modpack_content.empty()) //is a modpack if(mod.is_modpack)
{ {
std::vector<ModSpec> content = flattenMods(mod.modpack_content); std::vector<ModSpec> content = flattenMods(mod.modpack_content);
result.reserve(result.size() + content.size()); result.reserve(result.size() + content.size());

@ -53,6 +53,8 @@ struct ModSpec
//if normal mod: //if normal mod:
std::set<std::string> depends; std::set<std::string> depends;
std::set<std::string> unsatisfied_depends; std::set<std::string> unsatisfied_depends;
bool is_modpack;
// if modpack: // if modpack:
std::map<std::string,ModSpec> modpack_content; std::map<std::string,ModSpec> modpack_content;
ModSpec(const std::string name_="", const std::string path_="", ModSpec(const std::string name_="", const std::string path_="",
@ -61,6 +63,7 @@ struct ModSpec
path(path_), path(path_),
depends(depends_), depends(depends_),
unsatisfied_depends(depends_), unsatisfied_depends(depends_),
is_modpack(false),
modpack_content() modpack_content()
{} {}
}; };

@ -244,6 +244,8 @@ public:
updated[name] = true; updated[name] = true;
} }
else //file contains a setting which is not in m_settings
value_changed=true;
return true; return true;
} }

@ -1,7 +1,7 @@
/* /*
Minetest-c55 Minetest-c55
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>, Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>,
2012 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl> 2012-2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by 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 the Free Software Foundation; either version 2.1 of the License, or
@ -118,7 +118,7 @@ void spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef, TreeD
core::map<v3s16, MapBlock*> modified_blocks; core::map<v3s16, MapBlock*> modified_blocks;
ManualMapVoxelManipulator vmanip(map); ManualMapVoxelManipulator vmanip(map);
v3s16 tree_blockp = getNodeBlockPos(p0); v3s16 tree_blockp = getNodeBlockPos(p0);
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,2,1)); vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,3,1));
make_ltree (vmanip, p0, ndef, tree_definition); make_ltree (vmanip, p0, ndef, tree_definition);
vmanip.blitBackAll(&modified_blocks); vmanip.blitBackAll(&modified_blocks);
@ -170,7 +170,10 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
//initialize rotation matrix, position and stacks for branches //initialize rotation matrix, position and stacks for branches
core::matrix4 rotation; core::matrix4 rotation;
rotation = setRotationAxisRadians(rotation, M_PI/2,v3f(0,0,1)); rotation = setRotationAxisRadians(rotation, M_PI/2,v3f(0,0,1));
v3f position = v3f(0,0,0); v3f position;
position.X = p0.X;
position.Y = p0.Y;
position.Z = p0.Z;
std::stack <core::matrix4> stack_orientation; std::stack <core::matrix4> stack_orientation;
std::stack <v3f> stack_position; std::stack <v3f> stack_position;
@ -223,16 +226,16 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
//make sure tree is not floating in the air //make sure tree is not floating in the air
if (tree_definition.trunk_type == "double") if (tree_definition.trunk_type == "double")
{ {
make_tree_node_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y-1,p0.Z+position.Z),dirtnode); tree_node_placement(vmanip,v3f(position.X+1,position.Y-1,position.Z),dirtnode);
make_tree_node_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y-1,p0.Z+position.Z+1),dirtnode); tree_node_placement(vmanip,v3f(position.X,position.Y-1,position.Z+1),dirtnode);
make_tree_node_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y-1,p0.Z+position.Z+1),dirtnode); tree_node_placement(vmanip,v3f(position.X+1,position.Y-1,position.Z+1),dirtnode);
} }
if (tree_definition.trunk_type == "crossed") if (tree_definition.trunk_type == "crossed")
{ {
make_tree_node_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y-1,p0.Z+position.Z),dirtnode); tree_node_placement(vmanip,v3f(position.X+1,position.Y-1,position.Z),dirtnode);
make_tree_node_placement(vmanip,v3f(p0.X+position.X-1,p0.Y+position.Y-1,p0.Z+position.Z),dirtnode); tree_node_placement(vmanip,v3f(position.X-1,position.Y-1,position.Z),dirtnode);
make_tree_node_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y-1,p0.Z+position.Z+1),dirtnode); tree_node_placement(vmanip,v3f(position.X,position.Y-1,position.Z+1),dirtnode);
make_tree_node_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y-1,p0.Z+position.Z-1),dirtnode); tree_node_placement(vmanip,v3f(position.X,position.Y-1,position.Z-1),dirtnode);
} }
/* build tree out of generated axiom /* build tree out of generated axiom
@ -241,7 +244,9 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
G - move forward one unit with the pen up G - move forward one unit with the pen up
F - move forward one unit with the pen down drawing trunks and branches F - move forward one unit with the pen down drawing trunks and branches
f - move forward one unit with the pen down drawing leaves f - move forward one unit with the pen down drawing leaves (100% chance)
T - move forward one unit with the pen down drawing trunks only
R - move forward one unit with the pen down placing fruit
A - replace with rules set A A - replace with rules set A
B - replace with rules set B B - replace with rules set B
C - replace with rules set C C - replace with rules set C
@ -275,35 +280,54 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
dir = transposeMatrix(rotation,dir); dir = transposeMatrix(rotation,dir);
position+=dir; position+=dir;
break; break;
case 'T':
tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z),tree_definition);
if (tree_definition.trunk_type == "double" && !tree_definition.thin_branches)
{
tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z),tree_definition);
tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z+1),tree_definition);
tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z+1),tree_definition);
}
if (tree_definition.trunk_type == "crossed" && !tree_definition.thin_branches)
{
tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z),tree_definition);
tree_trunk_placement(vmanip,v3f(position.X-1,position.Y,position.Z),tree_definition);
tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z+1),tree_definition);
tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z-1),tree_definition);
}
dir = v3f(1,0,0);
dir = transposeMatrix(rotation,dir);
position+=dir;
break;
case 'F': case 'F':
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y,p0.Z+position.Z),tree_definition); tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z),tree_definition);
if ((stack_orientation.empty() && tree_definition.trunk_type == "double") || if ((stack_orientation.empty() && tree_definition.trunk_type == "double") ||
(!stack_orientation.empty() && tree_definition.trunk_type == "double" && !tree_definition.thin_branches)) (!stack_orientation.empty() && tree_definition.trunk_type == "double" && !tree_definition.thin_branches))
{ {
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y,p0.Z+position.Z),tree_definition); tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z),tree_definition);
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y,p0.Z+position.Z+1),tree_definition); tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z+1),tree_definition);
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y,p0.Z+position.Z+1),tree_definition); tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z+1),tree_definition);
} }
if ((stack_orientation.empty() && tree_definition.trunk_type == "crossed") || if ((stack_orientation.empty() && tree_definition.trunk_type == "crossed") ||
(!stack_orientation.empty() && tree_definition.trunk_type == "crossed" && !tree_definition.thin_branches)) (!stack_orientation.empty() && tree_definition.trunk_type == "crossed" && !tree_definition.thin_branches))
{ {
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X+1,p0.Y+position.Y,p0.Z+position.Z),tree_definition); tree_trunk_placement(vmanip,v3f(position.X+1,position.Y,position.Z),tree_definition);
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X-1,p0.Y+position.Y,p0.Z+position.Z),tree_definition); tree_trunk_placement(vmanip,v3f(position.X-1,position.Y,position.Z),tree_definition);
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y,p0.Z+position.Z+1),tree_definition); tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z+1),tree_definition);
make_tree_trunk_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y,p0.Z+position.Z-1),tree_definition); tree_trunk_placement(vmanip,v3f(position.X,position.Y,position.Z-1),tree_definition);
} }
if (stack_orientation.empty() == false) if (stack_orientation.empty() == false)
{ {
s16 size = 1; s16 size = 1;
for(x=-size; x<size+1; x++) for(x=-size; x<=size; x++)
for(y=-size; y<size+1; y++) for(y=-size; y<=size; y++)
for(z=-size; z<size+1; z++) for(z=-size; z<=size; z++)
if (abs(x) == size && abs(y) == size && abs(z) == size) if (abs(x) == size && abs(y) == size && abs(z) == size)
{ {
make_tree_leaves_placement(vmanip,v3f(p0.X+position.X+x+1,p0.Y+position.Y+y,p0.Z+position.Z+z),tree_definition); tree_leaves_placement(vmanip,v3f(position.X+x+1,position.Y+y,position.Z+z),tree_definition);
make_tree_leaves_placement(vmanip,v3f(p0.X+position.X+x-1,p0.Y+position.Y+y,p0.Z+position.Z+z),tree_definition); tree_leaves_placement(vmanip,v3f(position.X+x-1,position.Y+y,position.Z+z),tree_definition);
make_tree_leaves_placement(vmanip,v3f(p0.X+position.X+x,p0.Y+position.Y+y,p0.Z+position.Z+z+1),tree_definition); tree_leaves_placement(vmanip,v3f(position.X+x,position.Y+y,position.Z+z+1),tree_definition);
make_tree_leaves_placement(vmanip,v3f(p0.X+position.X+x,p0.Y+position.Y+y,p0.Z+position.Z+z-1),tree_definition); tree_leaves_placement(vmanip,v3f(position.X+x,position.Y+y,position.Z+z-1),tree_definition);
} }
} }
dir = v3f(1,0,0); dir = v3f(1,0,0);
@ -311,12 +335,19 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
position+=dir; position+=dir;
break; break;
case 'f': case 'f':
make_tree_leaves_placement(vmanip,v3f(p0.X+position.X,p0.Y+position.Y,p0.Z+position.Z),tree_definition); tree_single_leaves_placement(vmanip,v3f(position.X,position.Y,position.Z),tree_definition);
dir = v3f(1,0,0); dir = v3f(1,0,0);
dir = transposeMatrix(rotation,dir); dir = transposeMatrix(rotation,dir);
position+=dir; position+=dir;
break; break;
// turtle commands case 'R':
tree_fruit_placement(vmanip,v3f(position.X,position.Y,position.Z),tree_definition);
dir = v3f(1,0,0);
dir = transposeMatrix(rotation,dir);
position+=dir;
break;
// turtle orientation commands
case '[': case '[':
stack_orientation.push(rotation); stack_orientation.push(rotation);
stack_position.push(position); stack_position.push(position);
@ -363,7 +394,7 @@ void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *nd
} }
} }
void make_tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
MapNode node) MapNode node)
{ {
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z)); v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
@ -376,7 +407,7 @@ void make_tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = node; vmanip.m_data[vmanip.m_area.index(p1)] = node;
} }
void make_tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition) TreeDef &tree_definition)
{ {
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z)); v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
@ -389,7 +420,7 @@ void make_tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode; vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode;
} }
void make_tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition) TreeDef &tree_definition)
{ {
MapNode leavesnode=tree_definition.leavesnode; MapNode leavesnode=tree_definition.leavesnode;
@ -413,6 +444,35 @@ void make_tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode; vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
} }
void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition)
{
MapNode leavesnode=tree_definition.leavesnode;
if (myrand_range(1,100) > 100-tree_definition.leaves2_chance)
leavesnode=tree_definition.leaves2node;
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
if(vmanip.m_area.contains(p1) == false)
return;
u32 vi = vmanip.m_area.index(p1);
if(vmanip.m_data[vi].getContent() != CONTENT_AIR
&& vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
return;
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
}
void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
if(vmanip.m_area.contains(p1) == false)
return;
u32 vi = vmanip.m_area.index(p1);
if(vmanip.m_data[vi].getContent() != CONTENT_AIR
&& vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
return;
vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.fruitnode;
}
irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle, v3f axis) irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle, v3f axis)
{ {
double c = cos(angle); double c = cos(angle);

@ -1,7 +1,7 @@
/* /*
Minetest-c55 Minetest-c55
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>, Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>,
2012 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl> 2012-2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by 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 the Free Software Foundation; either version 2.1 of the License, or
@ -57,14 +57,19 @@ int fruit_chance;
void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef, void make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition); TreeDef tree_definition);
// Spawn L-systems tree from LUA // Spawn L-systems tree from LUA
void spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef, TreeDef tree_definition); void spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition);
// L-System tree gen helper functions // L-System tree gen helper functions
void make_tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
MapNode node); MapNode node);
void make_tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition); TreeDef &tree_definition);
void make_tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition);
void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition);
void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
TreeDef &tree_definition); TreeDef &tree_definition);
irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle,v3f axis); irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle,v3f axis);

@ -15,7 +15,8 @@ openal_stripped_file=$dir/openal_stripped.zip
mingwm10_dll_file=$dir/mingwm10.dll mingwm10_dll_file=$dir/mingwm10.dll
irrlicht_version=1.7.2 irrlicht_version=1.7.2
ogg_version=1.2.1 ogg_version=1.2.1
vorbis_version=1.3.2 vorbis_version=1.3.3
curl_version=7.18.0
# unzip -l $openal_stripped_file: # unzip -l $openal_stripped_file:
# 0 2012-04-03 00:25 openal_stripped/ # 0 2012-04-03 00:25 openal_stripped/
@ -33,26 +34,33 @@ mkdir -p $libdir
cd $builddir cd $builddir
# Get stuff # Get stuff
wget http://downloads.sourceforge.net/irrlicht/irrlicht-$irrlicht_version.zip \ [ -e $packagedir/irrlicht-$irrlicht_version.zip ] || wget http://downloads.sourceforge.net/irrlicht/irrlicht-$irrlicht_version.zip \
-c -O $packagedir/irrlicht-$irrlicht_version.zip || exit 1 -c -O $packagedir/irrlicht-$irrlicht_version.zip || exit 1
wget http://www.winimage.com/zLibDll/zlib125.zip \ [ -e $packagedir/zlib125.zip ] || wget http://www.winimage.com/zLibDll/zlib125.zip \
-c -O $packagedir/zlib125.zip || exit 1 -c -O $packagedir/zlib125.zip || exit 1
wget http://www.winimage.com/zLibDll/zlib125dll.zip \ [ -e $packagedir/zlib125dll.zip ] || wget http://www.winimage.com/zLibDll/zlib125dll.zip \
-c -O $packagedir/zlib125dll.zip || exit 1 -c -O $packagedir/zlib125dll.zip || exit 1
wget http://switch.dl.sourceforge.net/project/winlibs/libogg/libogg-$ogg_version-dev.7z \ [ -e $packagedir/libogg-$ogg_version-dev.7z ] || wget http://mirror.transact.net.au/sourceforge/w/project/wi/winlibs/libogg/libogg-$ogg_version-dev.7z \
-c -O $packagedir/libogg-$ogg_version-dev.7z || exit 1 -c -O $packagedir/libogg-$ogg_version-dev.7z || exit 1
wget http://switch.dl.sourceforge.net/project/winlibs/libogg/libogg-$ogg_version-dll.7z \ [ -e $packagedir/libogg-$ogg_version-dll.7z ] || wget http://mirror.transact.net.au/sourceforge/w/project/wi/winlibs/libogg/libogg-$ogg_version-dll.7z \
-c -O $packagedir/libogg-$ogg_version-dll.7z || exit 1 -c -O $packagedir/libogg-$ogg_version-dll.7z || exit 1
wget http://switch.dl.sourceforge.net/project/winlibs/libvorbis/libvorbis-$vorbis_version-dev.7z \ [ -e $packagedir/libvorbis-$vorbis_version-dev.7z ] || wget http://minetest.ru/bin/libvorbis-$vorbis_version-dev.7z \
-c -O $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1 -c -O $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1
wget http://switch.dl.sourceforge.net/project/winlibs/libvorbis/libvorbis-$vorbis_version-dll.7z \ [ -e $packagedir/libvorbis-$vorbis_version-dll.7z ] || wget http://minetest.ru/bin/libvorbis-$vorbis_version-dll.7z \
-c -O $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1 -c -O $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1
[ -e $packagedir/libcurl-$curl_version-win32-msvc.zip ] || wget http://curl.haxx.se/download/libcurl-$curl_version-win32-msvc.zip \
-c -O $packagedir/libcurl-$curl_version-win32-msvc.zip || exit 1
wget http://github.com/celeron55/minetest/zipball/master \ wget http://github.com/celeron55/minetest/zipball/master \
-c -O $packagedir/minetest.zip || exit 1 -c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/celeron55/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
cp $openal_stripped_file $packagedir/openal_stripped.zip || exit 1 [ -e $packagedir/minetest.zip ] || (echo "minetest.zip not found"; exit 1)
cp $mingwm10_dll_file $packagedir/mingwm10.dll || exit 1
wget http://github.com/celeron55/minetest_game/zipball/master \ wget http://github.com/celeron55/minetest_game/zipball/master \
-c -O $packagedir/minetest_game.zip || exit 1 -c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/celeron55/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
[ -e $packagedir/minetest_game.zip ] || (echo "minetest_game.zip not found"; exit 1)
[ -e $packagedir/openal_stripped.zip ] || wget http://minetest.ru/bin/openal_stripped.zip \
-c -O $packagedir/openal_stripped.zip || exit 1
[ -e $packagedir/mingwm10.dll ] || wget http://minetest.ru/bin/mingwm10.dll \
-c -O $packagedir/mingwm10.dll || exit 1
# Figure out some path names from the packages # Figure out some path names from the packages
minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^c]*//' -e 's/\/.*$//'` minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^c]*//' -e 's/\/.*$//'`
@ -69,6 +77,7 @@ unzip -o $packagedir/zlib125dll.zip -d zlib125dll || exit 1
7z x -y -olibogg $packagedir/libogg-$ogg_version-dll.7z || exit 1 7z x -y -olibogg $packagedir/libogg-$ogg_version-dll.7z || exit 1
7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1
7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1
unzip -o $packagedir/libcurl-$curl_version-win32-msvc.zip -d libcurl || exit 1
unzip -o $packagedir/openal_stripped.zip || exit 1 unzip -o $packagedir/openal_stripped.zip || exit 1
cd $builddir || exit 1 cd $builddir || exit 1
unzip -o $packagedir/minetest.zip || exit 1 unzip -o $packagedir/minetest.zip || exit 1
@ -106,6 +115,10 @@ cmake $minetestdir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file -DENABLE_SOUND=1 \
-DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include \ -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include \
-DOPENAL_LIBRARY=$libdir/openal_stripped/lib/OpenAL32.lib \ -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/OpenAL32.lib \
-DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \ -DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \
-DENABLE_CURL=1 \
-DCURL_DLL=$libdir/libcurl/libcurl.dll \
-DCURL_INCLUDE_DIR=$libdir/libcurl/include \
-DCURL_LIBRARY=$libdir/libcurl/libcurl.lib \
-DMINGWM10_DLL=$packagedir/mingwm10.dll \ -DMINGWM10_DLL=$packagedir/mingwm10.dll \
-DCMAKE_INSTALL_PREFIX=/tmp \ -DCMAKE_INSTALL_PREFIX=/tmp \
-DVERSION_EXTRA=$git_hash \ -DVERSION_EXTRA=$git_hash \