From 843ffba567d9b9cb170e9d9cc76469e796ca93cb Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 28 May 2011 02:17:19 +0200 Subject: [PATCH 01/40] + sandstone --- data/sandstone.png | Bin 0 -> 772 bytes src/mapnode.cpp | 8 ++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 16 ++++++++++++++++ src/tile.cpp | 1 + 6 files changed, 27 insertions(+) create mode 100644 data/sandstone.png diff --git a/data/sandstone.png b/data/sandstone.png new file mode 100644 index 0000000000000000000000000000000000000000..c4759b4d0289346f97ba69c44230d34b409c2a1d GIT binary patch literal 772 zcmV+f1N;1mP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RW1sfMI6;LOBPXGV{mPtfGR4C5{ z!E18bH~;`(OP2f$et=CNWJ^K{G-;>P8}#>{aZl6C3N>(IRF3nVOcihLMV#DDE)GOzgR96 zDKXX{1ZkQ;sD@!ko5u4zP1AxPXifw{MXBn#s%u866e3O%+qP%3SzZ)U%BE??5F*VqXD_u7XL*GW*G)peVV~p`?wWf@&*Xz5x_pe1+Rh5cV z#Jg_4j}b<;WpeHU)lsA<53dkHP19P&eBb~5`+4zhxmvx@hQcrm!XWS*=jYQe#uz)D zo}ZpCFD{i%wu}khA%tAV$@6^BA7ojITGnDsGjx402yEMWdHLn}ZXCxdQu~&lw7kp< zLQaE0KpQ%JGlh&X!!!`a^@;5Fe_Gz1**!vt>$nIZ+qPTIgD{-W=f3Yp+X$Mb>GYiD zbmA?~i@dHYP1D-8MHuis_ground_content = true; f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_SANDSTONE; + f = &g_content_features[i]; + f->setAllTextures("sandstone.png"); + f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png"); + f->param_type = CPT_MINERAL; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(CONTENT_SAND)+" 1"; + i = CONTENT_TREE; f = &g_content_features[i]; f->setAllTextures("tree.png"); diff --git a/src/mapnode.h b/src/mapnode.h index 57382aa2b..ad256585f 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -101,6 +101,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_STEEL 19 #define CONTENT_GLASS 20 #define CONTENT_FENCE 21 +#define CONTENT_SANDSTONE 22 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 841f1d655..60c1894bf 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -59,6 +59,7 @@ void initializeMaterialProperties() */ setStoneLikeDiggingProperties(CONTENT_STONE, 1.0); + setStoneLikeDiggingProperties(CONTENT_SANDSTONE, 1.0); setStoneLikeDiggingProperties(CONTENT_MESE, 0.5); setStoneLikeDiggingProperties(CONTENT_COALSTONE, 1.5); setStoneLikeDiggingProperties(CONTENT_FURNACE, 3.0); diff --git a/src/server.cpp b/src/server.cpp index 9248e6298..c7b64f413 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3972,6 +3972,21 @@ void Server::UpdateCrafting(u16 peer_id) found = true; } } + + // Sandstone + if(!found) + { + ItemSpec specs[9]; + specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_SAND); + specs[4] = ItemSpec(ITEM_MATERIAL, CONTENT_SAND); + specs[6] = ItemSpec(ITEM_MATERIAL, CONTENT_SAND); + specs[7] = ItemSpec(ITEM_MATERIAL, CONTENT_SAND); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_SANDSTONE, 1)); + found = true; + } + } } } // if creative_mode == false @@ -4060,6 +4075,7 @@ void setCreativeInventory(Player *player) CONTENT_MUD, CONTENT_STONE, CONTENT_SAND, + CONTENT_SANDSTONE, CONTENT_TREE, CONTENT_LEAVES, CONTENT_GLASS, diff --git a/src/tile.cpp b/src/tile.cpp index dabc1dcf3..8b0c3f2ea 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -506,6 +506,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("stone.png"); sourcelist.push_back("mud.png"); sourcelist.push_back("sand.png"); + sourcelist.push_back("sandstone.png"); sourcelist.push_back("grass.png"); sourcelist.push_back("grass_footsteps.png"); sourcelist.push_back("tree.png"); From 2176f4d69787e11033dd08fc4377a60b67682a88 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 18:45:50 +0200 Subject: [PATCH 02/40] * better player graphics --- data/player.png | Bin 212 -> 652 bytes data/player_back.png | Bin 201 -> 292 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/player.png b/data/player.png index 90adf97476ecd3442dcd435201658ebfaef9d7ab..60ac4854ba00dc30c692e4fafdd6a0810d0806fb 100644 GIT binary patch delta 615 zcmV-t0+{{O0gMHZ91;O+j>uX70004VQb$4nuFf3kks%m=2XskIMF-mj8Wt-G&1bc8 z0006WNkl za=B9FRR7YO=47|M4gl=;>I{HoZ9@B^V9|zNoh@5`FaVHc3*K+GGgCGJfGJ3a_+?QG zX_HhRx4&v9XTw$y^81d) zAnha>yo=2RB@qfcE+raX_;Q(WuSuj)>f-e2AX>csR?`{O#Y{~lnkAc}HcPb`&0+`5 zVn^$LB=HNH#mV{+oOgBSUFW3Uvk&K=R+>gxgWK91{{fAO1W^PJsc!%P002ovPDHLkV1jeR B8#n*} delta 172 zcmV;d08{^r1=InM90dRyiTKQsE*O7?Nkl569sGa~0-TA{S>tn2Gi5US)fn%_IB-w+G!_iCux}jBA8FpZ a2p}uF=p{1q#6|1?0000tn$piC43Xx-kl$iBc~N0|PJu@#W4uyc&%2juPR5|Nn^-V_;xl!5R1e|Kp2FxFn;D zy7B+;@>$r;V1zi3@&7-p@+&*jFv9>Pnc~nmnvk$0Bv@z@3V%Rs>R1>U7#PYW=fMTK zo+aRol`^RXaQ-Ul`u07gbEDUgvuFW@QNFkSHW(_ail?>_&f%00000NkvXXu0mjfat}zN From 00763399142cd196e7b4d947485e53409947b559 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 18:47:40 +0200 Subject: [PATCH 03/40] * enemies are now omsk birds --- data/oerkki1.png | Bin 212 -> 270 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/oerkki1.png b/data/oerkki1.png index c32fb99dbc9381cba551ef0c96482624ec72792a..aad2ddb41faada144601bfaaf02cdd814ad4bb97 100644 GIT binary patch delta 242 zcmVNklS|Iv5xjI14-?iy0XBj({-ZRBb+KpkSG&i(`mK=i5o% zd4 i%EWmS7?>p*UNGiaDqB1j Date: Sun, 29 May 2011 18:48:21 +0200 Subject: [PATCH 04/40] * better rat graphics --- data/rat.png | Bin 920 -> 276 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/rat.png b/data/rat.png index d1a0e2ae26ad41a751c99ea84e79f45e58c1970b..96d44c3fae171d9d1e59d8137315f0d61697abd5 100644 GIT binary patch delta 249 zcmbQiK80z5ay0vvp$^%if|TqL>4nJa0`Pl zBg3pY5H=O_S>w|46-Jwyp7yIp(&m&jv*T7k4{+2cgR4*%|AZTaa)>iRJ&4! zNE7?K8MES+J&QQRGdX2_fx1WiHHK-*`TMHh@&753X5Fw(U+=nf!;`Q6CArKFp|U|A zDy*10R+}J8FRZr-*8JVbup?^m vlrF`5-K literal 920 zcmZvaJ!n-y5QPULFCirUU?XA`wh*xjSlMWNAr450`asJBZ6q8>WvisK2!UfERspe) z1X7NzKa~VcD-76Jh=uTwfDaMIxi=8reb)=SJA2vL@64Hfy0o}3J$Y_YM5gsd_jazQ za!gEga_&ER{9I&AmTvaua~t)DdWqac^|`y5kp!Tsr4$!25sE-WMM`G1ez}X8kOGLR zl>Z%aaTB8u0u?QJQ!A~F4>KnXpejlU(g9Ot#(=9@2CANON)0zR8bK(uXt6LlVNhy8 zVGs^AEi4GA=ZT`BrOtOBp{dz05abav{W-*@mWrJGws{fePP0r@AWzU8W=duZ_q;y? zbKK%5-<(=)Bsg>TXmBGm~SI56h&E4I5{qp_WweKe$eqQ+98QWd!A3PXr aZfsua$n2l Date: Sun, 29 May 2011 18:48:39 +0200 Subject: [PATCH 05/40] * better glass graphics --- data/glass.png | Bin 1309 -> 381 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/glass.png b/data/glass.png index 8598ce670f502802f166eb4b8d07a871b564d263..35ea596d54c5b3e0b55adb0081b71464f665b846 100644 GIT binary patch delta 338 zcmV-Y0j>U>3jG3*87Bq+001BJ|6u?C00DDSM?wIu&K&6g000JJOGiWiE&wzDHfw6~ z&yz_6Ab%SGGB7ZFeSZJ|0R2fsK~y-)rIWu3f>0R6&n>f|KSB@`K~lCf7Ck{j1mSD+ zP>#KVTkTDOLxTiDG(<*O2-UTSY%(*o4A1!8dw(3xcP^1+#YP;(0Z6i9ClFJKf7}F} zdjQ=gPb68fACF+pP;8M;hzHPU6i`iZgwng`;eTpnLRI%KNGJdR`u#do)qrKWka9VT z?UsVlo6i*!WR>T0U>KLpvPtZAXXyIndx(yT#f%5w%nZYd1_)E9Q~Dn;9xpMSuA}$h zJv;#D^=jB`&d{{O?;Z@=0vS!_zDuGgV6iy9dJ?*YN+plkOedcJmQBJmuQ;8qz8)}9 kf*%3^j!Os5N!;)J1a@y_++PjCNdN!<07*qoM6N<$f?NlT-T(jq literal 1309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstPBjy3;{kN zu0Zi+OHM9Za&G0alPi{;S+(Nq;>A}MExNj7@s+h}Z*ARrcgK!uU~(E|NiU8k3YYD{r&Uj-@kwV zfrgKQ(GVESArKNB#>2qC$WRjG7yN%@1BT%5?5e=H;w Date: Sun, 29 May 2011 18:49:02 +0200 Subject: [PATCH 06/40] * better heart icon --- data/heart.png | Bin 220 -> 258 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/heart.png b/data/heart.png index ddd273dd2f09fa7574ebb3f4ec6d802be1d259bb..bea1aefd6b22e3268f88db0eb26188b1cb362f81 100644 GIT binary patch delta 210 zcmV;@04@LA0fGXMBnkm@Qb$4nuFf3kkuey52XskIMF-mj8W%GHKxNM^0001#NklVQ zc5uf$mMgo6z)RnOHGYBE@E2eNX~Qny4B~~m3Xq?rh593L2{H=50gdG}LP=Bz2nYy#2xN$nE*O7)NklQ4)Y42t*%UJUY4k z#EjBnCSU5Z4+b;{L0Gw0?Z)FECC8qnM*(q>F)p6?a(qP a#|;$zH6R>2y-aQZ0000 Date: Sun, 29 May 2011 19:03:05 +0200 Subject: [PATCH 07/40] + README in main directory --- README | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000000000..e3e3a3491 --- /dev/null +++ b/README @@ -0,0 +1,14 @@ +Minetest Δ (“Minetest Delta”) is a fork of Minetest-c55 , incorporating experimental features that are not (yet) included in Minetest-c55. + +New bricks: +* Sandstone (crafted from 4 sand) + +Alternate graphics: +* Player +* Omsk birds (instead of Oerkki ghosts) +* Rat +* Glass + +Building on GNU/Linux: + cmake . -DRUN_IN_PLACE=1 + make -j2 From af574e58fe65e230f563f996496f31ce60291dc3 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 19:08:59 +0200 Subject: [PATCH 08/40] + .gitignore --- .gitignore | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..64ebbef66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +map/* +CMakeFiles/* +src/CMakeFiles/* +src/Makefile +src/cmake_config.h +src/cmake_install.cmake +src/jthread/CMakeFiles/* +src/jthread/Makefile +src/jthread/cmake_config.h +src/jthread/cmake_install.cmake +minetest.conf +bin/ +CMakeCache.txt +CPackConfig.cmake +CPackSourceConfig.cmake +Makefile +cmake_install.cmake +src/jthread/libjthread.a +debug.txt From ca26de72c93c03cbfbd90254f3cb09c86929405a Mon Sep 17 00:00:00 2001 From: teddydestodes Date: Sun, 29 May 2011 19:17:42 +0200 Subject: [PATCH 09/40] fast_move and free_move can now be toggled --- src/defaultsettings.cpp | 2 ++ src/game.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index f11b0b2d7..e2ace0fe2 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -40,6 +40,8 @@ void set_default_settings() g_settings.setDefault("keymap_inventory", "KEY_KEY_I"); g_settings.setDefault("keymap_chat", "KEY_KEY_T"); g_settings.setDefault("keymap_rangeselect", "KEY_KEY_R"); + g_settings.setDefault("keymap_freemove", "KEY_KEY_K"); + g_settings.setDefault("keymap_fastmove", "KEY_KEY_J"); // Some (temporary) keys for debugging g_settings.setDefault("keymap_special1", "KEY_KEY_E"); g_settings.setDefault("keymap_print_debug_stacks", "KEY_KEY_P"); diff --git a/src/game.cpp b/src/game.cpp index 603a86da3..7970a6ed9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1147,6 +1147,28 @@ void the_game( &g_menumgr, dest, L""))->drop(); } + else if(input->wasKeyDown(getKeySetting("keymap_freemove"))) + { + if(g_settings.getBool("free_move")) + { + g_settings.set("free_move","false"); + } + else + { + g_settings.set("free_move","true"); + } + } + else if(input->wasKeyDown(getKeySetting("keymap_fastmove"))) + { + if(g_settings.getBool("fast_move")) + { + g_settings.set("fast_move","false"); + } + else + { + g_settings.set("fast_move","true"); + } + } // Item selection with mouse wheel { From cf136f19359dd7983cddd3bdf9cac2c4a4bb8139 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 30 May 2011 01:08:59 +0800 Subject: [PATCH 10/40] + .gitignore --- .gitignore | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..64ebbef66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +map/* +CMakeFiles/* +src/CMakeFiles/* +src/Makefile +src/cmake_config.h +src/cmake_install.cmake +src/jthread/CMakeFiles/* +src/jthread/Makefile +src/jthread/cmake_config.h +src/jthread/cmake_install.cmake +minetest.conf +bin/ +CMakeCache.txt +CPackConfig.cmake +CPackSourceConfig.cmake +Makefile +cmake_install.cmake +src/jthread/libjthread.a +debug.txt From 880aa870a0316d8f2f3081bf117e8237af270405 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 30 May 2011 14:42:08 +0200 Subject: [PATCH 11/40] + cactii --- data/cactus_side.png | Bin 0 -> 279 bytes data/cactus_top.png | Bin 0 -> 236 bytes src/map.cpp | 34 +++++++++++++++++++++++++++------- src/mapnode.cpp | 10 ++++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 1 + src/tile.cpp | 2 ++ 8 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 data/cactus_side.png create mode 100644 data/cactus_top.png diff --git a/data/cactus_side.png b/data/cactus_side.png new file mode 100644 index 0000000000000000000000000000000000000000..fc479fde6f9dc859180035ee3974c1ffb198136c GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfZB`jZWp;PomG6K;D?MEtLo7~D4L-=rY{;P;c16+3{n-l% zo~ed;eP=Ez`Yn%(4-t`E_f#~I{kX%e3w8I{TaFg*RY{ut?$eCz{CxZyIx2VPG@9~r zZQ$N`V^(`YhJWbVie+|NxV1vH&%KG{n|R>FnR!nIIRDA$8gwV9DF68PV|r!x+xxa1 z7OQ5aKdf9aEA`u|RHvmWwkM{&$ri5PD)@0z=fB4(7Jq%hlfQ_~?wB+4)Kv-dyH9y{ X24^3`sfZB`jZNz+xuYT`hlI!_nJ5R21mgAWQGP~hmUw3wG%qH+91 z#ors@(R%K#RZo|4aJp!$z24aJ_IBg7*R{{RnoMW&Ft8p7NI$mX y_nodes_max - 6) continue; v3s16 p(x,y,z); - /* - Trees grow only on mud and grass - */ { u32 i = data->vmanip.m_area.index(v3s16(p)); MapNode *n = &data->vmanip.m_data[i]; - if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS) + if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS && n->d != CONTENT_SAND) continue; + // Trees grow only on mud and grass + if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) + { + p.Y++; + make_tree(data->vmanip, p); + } + // Cactii grow only on sand + if(n->d == CONTENT_SAND) + { + p.Y++; + make_cactus(data->vmanip, p); + } } - p.Y++; - // Make a tree - make_tree(data->vmanip, p); } } /*u32 tree_max = relative_area / 60; diff --git a/src/mapnode.cpp b/src/mapnode.cpp index c006b8222..8ceeecfba 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -215,6 +215,16 @@ void init_mapnode() } f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_CACTUS; + f = &g_content_features[i]; + f->setAllTextures("cactus_side.png"); + f->setTexture(0, "cactus_top.png"); + f->setTexture(1, "cactus_top.png"); + f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png"); + f->param_type = CPT_MINERAL; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_GLASS; f = &g_content_features[i]; f->light_propagates = true; diff --git a/src/mapnode.h b/src/mapnode.h index ad256585f..c4dcbfbe5 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -102,6 +102,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_GLASS 20 #define CONTENT_FENCE 21 #define CONTENT_SANDSTONE 22 +#define CONTENT_CACTUS 23 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 60c1894bf..a1d419562 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -73,6 +73,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_TREE, 1.0); setWoodLikeDiggingProperties(CONTENT_LEAVES, 0.15); + setWoodLikeDiggingProperties(CONTENT_CACTUS, 0.75); setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); diff --git a/src/server.cpp b/src/server.cpp index c7b64f413..994e62eaf 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4078,6 +4078,7 @@ void setCreativeInventory(Player *player) CONTENT_SANDSTONE, CONTENT_TREE, CONTENT_LEAVES, + CONTENT_CACTUS, CONTENT_GLASS, CONTENT_FENCE, CONTENT_MESE, diff --git a/src/tile.cpp b/src/tile.cpp index 8b0c3f2ea..2a2d2a70c 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -513,6 +513,8 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("tree_top.png"); sourcelist.push_back("water.png"); sourcelist.push_back("leaves.png"); + sourcelist.push_back("cactus_side.png"); + sourcelist.push_back("cactus_top.png"); sourcelist.push_back("glass.png"); sourcelist.push_back("mud.png^grass_side.png"); sourcelist.push_back("cobble.png"); From 0f4c83eb986dd48bf3745266d7cbdb9a4bf19507 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 02:56:23 +0200 Subject: [PATCH 12/40] * improved fence dimensions (cuboid side lengths now multiples of 2, textures should fit better) --- src/mapblock.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mapblock.cpp b/src/mapblock.cpp index c448ef236..d98bfaf1e 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1563,8 +1563,8 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio))); video::SColor c(255,l,l,l); - const f32 post_rad=(f32)BS/10; - const f32 bar_rad=(f32)BS/20; + const f32 post_rad=(f32)BS/(32.0/4.0); + const f32 bar_rad=(f32)BS/(32.0/2.0); const f32 bar_len=(f32)(BS/2)-post_rad; // The post - always present @@ -1581,12 +1581,12 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) { pos = intToFloat(p+blockpos_nodes, BS); pos.X += BS/2; - pos.Y += BS/4; + pos.Y += 3*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_len,bar_rad,bar_rad); - pos.Y -= BS/2; + pos.Y -= 6*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_len,bar_rad,bar_rad); @@ -1600,11 +1600,11 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) { pos = intToFloat(p+blockpos_nodes, BS); pos.Z += BS/2; - pos.Y += BS/4; + pos.Y += 3*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_rad,bar_rad,bar_len); - pos.Y -= BS/2; + pos.Y -= 6*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_rad,bar_rad,bar_len); From 6c3ca42e0e0096c481aa09da3c78be1901920899 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 02:56:41 +0200 Subject: [PATCH 13/40] + fence inventory icon --- data/fence.png | Bin 0 -> 539 bytes src/mapnode.cpp | 1 + 2 files changed, 1 insertion(+) create mode 100644 data/fence.png diff --git a/data/fence.png b/data/fence.png new file mode 100644 index 0000000000000000000000000000000000000000..0b99f0eb5dd6b27c9f478cc1eb8a510b59a97ea6 GIT binary patch literal 539 zcmV+$0_6RPP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RW1s?%42*8A&2LJ#8tw}^dR5;7c zkw0(KP!vax?dRBmkQAG!NGT}lz<>%W5)uPak&qA)Ux6JlF*7i+AoXjoAXZoyU;_!1 zg|ed{k>I2v#f}@l=YNl(RosSV>cXAxJ@?+bkdv>#bqen>=~C zed1xyAKlYoln_QUl*)Pee#a01zbBd%D@QmAfn2)n-G@&&ZXL&U5yGx6Snr-eTP0-{ zl0=dhkMHUqgCTk9(Dns&x51a*H?Cj1O1wWKj%TDG;G^NX@Vr?v9WuMaq=CC@R3$?-Odape6*CW%BxC|1g6oFqpq^voqG6)i#~g3p5*N zdD|Nw06e=uTPE5BjOAi=q@k5ylqJStp8z=LT|t+MvQ(gprGVR88zfQ@#WN;=`f@YJ&>4Qa#d+Vy5DkK#!9ThMz@1w+ zj_K(K5%IpnEK;1&6xSZ1Gs%Pdo5ys|0gHNe`nyMxRF#EbPaoA?0Y)LN#az#u-uT1} d7Ipt0^%oDf&+9E}8chHI002ovPDHLkV1kTAsetInventoryTexture("fence.png"); f->light_propagates = true; f->param_type = CPT_LIGHT; f->is_ground_content = true; From 461f53945d9d512dc7613a86cd03108dc9530681 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 20:52:20 +0200 Subject: [PATCH 14/40] * menulogo now shows minetest delta --- data/menulogo.png | Bin 498 -> 653 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/menulogo.png b/data/menulogo.png index 76595c48dc78e626365261633ec9f13b5e5eeaac..cb6983e5c6c2db4b98b810a236cb9df1f9680e4a 100644 GIT binary patch delta 609 zcmV-n0-pWy1C0fcBnkm@Qb$4nuFf3kkuev400(qQO+^RW1s?(j6;-b&w*UYFA4x<( zR9M69SG{T+F%bR)SEh2nE0; zUa+PxwO3NpLMLP*J~`7OZIobs3_@(e{j^!U35jjyPqG`j9;m} zHl#OG2Cv?)P}en@ra@IzaLz@2PeL`c2$51jsfgHB5i%wfJyc;+`u-_}$HW3gm7;6A zh)`T~>2I^SANun31OV{*)psaNwJ8uTHXRlc^eq_=Qf*z=0D#r1C1q7r+erAYrop|H vD4>KSOzvKr4A)W;($pYs^3}B`q1GCA9>Sp3AfMH^00000NkvXXu0mjfK|vn$ delta 453 zcmV;$0XqJT1@Z%sBn<>}LP=Bz2nYy#2xN$nE*F0Rlu1NER9J=WSKW=nAPoMH`gl8J z2?lWA?=1tJZ=lR@48RhZ#P^U=0W}0@Qt5R4BvgVw|B%`c8@%zxSrCZ2ZeW7!!pu4e z01+k6&bg{=Z!Ol(ZD{%$T6w)T^LUQ%t>MT$_U=yuGn-ulBM=B*3qC8d2RP@%IVWMB z|Av3L#xLo&@*e`f6-!<;noi7Vv3Zv795o-Y?jEnz-sxb-eZJYrMei^{x5qjk}awxvf^-tKdIA0RYz8R6v|Ob|oP2 z{Dz)Q;{Sru`-yK8A~LPK(*k7}CI~wuKGuJAO=#9yc<=A?fbIl50xe0X$!^E^@XM^( zWaeT#qgUL>AOGwgUy55J!2pu<6Uh8MV_6og>xyZb;Jr`gAqh=u6QX^{?llo-H6bM% zE%K7hmIfrpo^K6D$1@UljF9XiEXI7*1Cz8a;zojhvi0byU6us^Fwa|3PSXTnI|(iS vMy0)RIz+aEC{IEjy}h$ Date: Tue, 31 May 2011 22:04:09 +0200 Subject: [PATCH 15/40] + brick --- data/brick.png | Bin 0 -> 604 bytes src/mapnode.cpp | 8 ++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 1 + src/tile.cpp | 1 + 6 files changed, 12 insertions(+) create mode 100644 data/brick.png diff --git a/data/brick.png b/data/brick.png new file mode 100644 index 0000000000000000000000000000000000000000..32d77f34787b079f9df729bc398b780be98e83b1 GIT binary patch literal 604 zcmV-i0;BzjP)Px#32;bRa{vGi!~g&e!~vBn4jTXf00(qQO+^RW1snq+G7BMy;s5{v?ny*JR4C6i z(o1g}WdMcYXD;@5E{@YwP1=eLv?)kz5GorgemW}@ghaRrsvuAmk;-wC#*r`a*q$#l zVG%_-tFwB~s}r5DWX$2;zh8av)d77l0}Xrc-qtU^j98MB&WI@4-+!{9CZeUsiY-mk z)MTI}%_$ggcJ_WtkIRQ9VUK!MH)P~o6aDe_mwwh?E|yuA#c|y4_v1KTE|$H1FN&hJ zZ9@n}QFL905JL1lBW~$EBw_mV5BWFW#k}V^EfFg|Ir}FrxuNTn;|nUNCPb`d7e)x$Z2@Qf@=nw z4H8O5q%j?HhU+y7u6fQ4JxZ$44lW-AMt`3CmiE%=$LVlqm?TME*Kr(YS(X?1X1$qA zKD_$;5Yvy--AB81T}OYhCE=2U0WI0_QS$l?p7D;)_>UEzo}Q#Bfh7qCME9S|`Wpfh z9&<%OMp>2dgg$#<%aj>+-QAYK{WcKsjPvn%S{xtURb{hnUhO}b&1PxWEf>oW!i&l2 qaA!E5&u?$rtl4hXo9i^~b>06UK-MLJs6x^J0000^X literal 0 HcmV?d00001 diff --git a/src/mapnode.cpp b/src/mapnode.cpp index cfb1a493f..72cd762c6 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -189,6 +189,14 @@ void init_mapnode() f->is_ground_content = true; f->dug_item = std::string("MaterialItem ")+itos(CONTENT_SAND)+" 1"; + i = CONTENT_BRICK; + f = &g_content_features[i]; + f->setAllTextures("brick.png"); + f->setInventoryTextureCube("brick.png", "brick.png", "brick.png"); + f->param_type = CPT_MINERAL; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_TREE; f = &g_content_features[i]; f->setAllTextures("tree.png"); diff --git a/src/mapnode.h b/src/mapnode.h index c4dcbfbe5..5022031de 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -103,6 +103,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_FENCE 21 #define CONTENT_SANDSTONE 22 #define CONTENT_CACTUS 23 +#define CONTENT_BRICK 24 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index a1d419562..0c744af9f 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -60,6 +60,7 @@ void initializeMaterialProperties() setStoneLikeDiggingProperties(CONTENT_STONE, 1.0); setStoneLikeDiggingProperties(CONTENT_SANDSTONE, 1.0); + setStoneLikeDiggingProperties(CONTENT_BRICK, 3.0); setStoneLikeDiggingProperties(CONTENT_MESE, 0.5); setStoneLikeDiggingProperties(CONTENT_COALSTONE, 1.5); setStoneLikeDiggingProperties(CONTENT_FURNACE, 3.0); diff --git a/src/server.cpp b/src/server.cpp index 994e62eaf..dfc05f7d3 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4076,6 +4076,7 @@ void setCreativeInventory(Player *player) CONTENT_STONE, CONTENT_SAND, CONTENT_SANDSTONE, + CONTENT_BRICK, CONTENT_TREE, CONTENT_LEAVES, CONTENT_CACTUS, diff --git a/src/tile.cpp b/src/tile.cpp index 2a2d2a70c..361de704c 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -507,6 +507,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("mud.png"); sourcelist.push_back("sand.png"); sourcelist.push_back("sandstone.png"); + sourcelist.push_back("brick.png"); sourcelist.push_back("grass.png"); sourcelist.push_back("grass_footsteps.png"); sourcelist.push_back("tree.png"); From cffd40c5d6c1427d2cce7cbcfe57669da73459c6 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 04:57:46 +0200 Subject: [PATCH 16/40] + clay and associated items --- data/clay.png | Bin 0 -> 613 bytes data/clay_brick.png | Bin 0 -> 249 bytes data/lump_of_clay.png | Bin 0 -> 210 bytes src/inventory.cpp | 8 +++++++- src/map.cpp | 12 +++++++++++- src/mapnode.cpp | 10 +++++++++- src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 31 +++++++++++++++++++++++++++++++ src/tile.cpp | 1 + 10 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 data/clay.png create mode 100644 data/clay_brick.png create mode 100644 data/lump_of_clay.png diff --git a/data/clay.png b/data/clay.png new file mode 100644 index 0000000000000000000000000000000000000000..3557429d81f05837cb54ea3a964392bf28b78440 GIT binary patch literal 613 zcmV-r0-F7aP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RW1sn(m2F^1>Q2+n|_en%SR4C6q zkxOnPF$_d0iTbqKZNLtk`yVB@36MB(+-mDDauxz+$wh(n>WPn!4*;;%T5I=xmr@EL zh)5~5@B8ENaL%1hC#^LR{r>)9@4b}5%prtr+rGcQt+mcMBC^)Ly}gYwnE5ykM0Czc zV~jCojL~~X#LMNfEQ@oll+t_m-UC2u&00Ig007y0mr|ZiCu2;Ek%(f9wboJ!0C?}M zwch)mpPyRmvMe}zd+(V!r6hz1At0jG+BwI}r4&Sbe}6Bf5Rnu@AR;qQbgeZa_TH6J zM06Yn5h3E|=Vz@ICkFtGF~%6y+7JRW=bVi(Qc7m_-k;CsoHGEVlyHo397k)dlrqMc ze9Wwrsnp~nl)`=Ag%ESW|1i^ct(AxXAcQdWx7K9u{q=ga z*0k2Q+igmfQqHh3hKPg^x7%&oHYugtwryS4ZQCaIwr#c6S$&RMYhBlM-}fmLuh(m9 zO(~U9(pod~R58uWVzt)G<)V}V0Ljc#r&3Bv`FK3M_q}&x%=vs4LRf1j`V7nCIGl6y zzTfXDrFC6juUD-V0Ep;%y=tvP2!DTn&*$?W^X_;XQ#;Q+00000NkvXXu0mjfk1-eJ literal 0 HcmV?d00001 diff --git a/data/clay_brick.png b/data/clay_brick.png new file mode 100644 index 0000000000000000000000000000000000000000..e36648e48f68ab3c201132839093a18a7387a72f GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRt!3HF+tk*dLq!^2X+?^QKos)S9vL>4nJ z@Bt`9QzT_P~k`sfZB`i$4%x%!rWFB&QaoK8Lo7}wCrGd|^Gg(Z>O^jOV&5Yx zEPU8w3*!l?i;QN?5e1t2YJZyr#w94Z7T4DPt>422R<+SA*|Z_#tOT2hnVHd};F{;> xWZ4!m3r=TSbjh)##N^tFm|Z2B%2$Jx7`FaU%KpTr(hana!PC{xWt~$(69C^6KP~_O literal 0 HcmV?d00001 diff --git a/src/inventory.cpp b/src/inventory.cpp index 47a8d4de9..3f83c7419 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -160,8 +160,12 @@ video::ITexture * CraftItem::getImage() name = "lump_of_coal.png"; else if(m_subname == "lump_of_iron") name = "lump_of_iron.png"; + else if(m_subname == "lump_of_clay") + name = "lump_of_clay.png"; else if(m_subname == "steel_ingot") name = "steel_ingot.png"; + else if(m_subname == "clay_brick") + name = "clay_brick.png"; else if(m_subname == "rat") name = "rat.png"; else @@ -199,7 +203,7 @@ u16 CraftItem::getDropCount() bool CraftItem::isCookable() { - if(m_subname == "lump_of_iron") + if(m_subname == "lump_of_iron" || m_subname == "lump_of_clay") { return true; } @@ -212,6 +216,8 @@ InventoryItem *CraftItem::createCookResult() { return new CraftItem("steel_ingot", 1); } + else if(m_subname == "lump_of_clay") + return new CraftItem("clay_brick", 1); return NULL; } diff --git a/src/map.cpp b/src/map.cpp index c48599d47..bf9f38c87 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3141,6 +3141,13 @@ void makeChunk(ChunkMakeData *data) if(have_sand == false) continue; + // Determine whether to have clay in the sand here + double claynoise = noise2d_perlin( + 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, + data->seed+4321, 8, 0.95); + + bool have_clay = have_sand && (claynoise > 0.95); + // Find ground level s16 surface_y = find_ground_level_clever(data->vmanip, p2d); @@ -3157,7 +3164,10 @@ void makeChunk(ChunkMakeData *data) MapNode *n = &data->vmanip.m_data[i]; if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) { - n->d = CONTENT_SAND; + if(have_clay && (surface_y == WATER_LEVEL)) + n->d = CONTENT_CLAY; + else + n->d = CONTENT_SAND; } else { diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 72cd762c6..cef9bbf03 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -189,13 +189,21 @@ void init_mapnode() f->is_ground_content = true; f->dug_item = std::string("MaterialItem ")+itos(CONTENT_SAND)+" 1"; + i = CONTENT_CLAY; + f = &g_content_features[i]; + f->setAllTextures("clay.png"); + f->setInventoryTextureCube("clay.png", "clay.png", "clay.png"); + f->param_type = CPT_MINERAL; + f->is_ground_content = true; + f->dug_item = std::string("CraftItem lump_of_clay 4"); + i = CONTENT_BRICK; f = &g_content_features[i]; f->setAllTextures("brick.png"); f->setInventoryTextureCube("brick.png", "brick.png", "brick.png"); f->param_type = CPT_MINERAL; f->is_ground_content = true; - f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + f->dug_item = std::string("CraftItem clay_brick 4"); i = CONTENT_TREE; f = &g_content_features[i]; diff --git a/src/mapnode.h b/src/mapnode.h index 5022031de..e8cc0ab51 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -104,6 +104,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_SANDSTONE 22 #define CONTENT_CACTUS 23 #define CONTENT_BRICK 24 +#define CONTENT_CLAY 25 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 0c744af9f..8c23056f2 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -71,6 +71,7 @@ void initializeMaterialProperties() setDirtLikeDiggingProperties(CONTENT_GRASS, 1.0); setDirtLikeDiggingProperties(CONTENT_GRASS_FOOTSTEPS, 1.0); setDirtLikeDiggingProperties(CONTENT_SAND, 1.0); + setDirtLikeDiggingProperties(CONTENT_CLAY, 1.0); setWoodLikeDiggingProperties(CONTENT_TREE, 1.0); setWoodLikeDiggingProperties(CONTENT_LEAVES, 0.15); diff --git a/src/server.cpp b/src/server.cpp index dfc05f7d3..17850c5fa 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3987,6 +3987,36 @@ void Server::UpdateCrafting(u16 peer_id) found = true; } } + + // Clay + if(!found) + { + ItemSpec specs[9]; + specs[3] = ItemSpec(ITEM_CRAFT, "lump_of_clay"); + specs[4] = ItemSpec(ITEM_CRAFT, "lump_of_clay"); + specs[6] = ItemSpec(ITEM_CRAFT, "lump_of_clay"); + specs[7] = ItemSpec(ITEM_CRAFT, "lump_of_clay"); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_CLAY, 1)); + found = true; + } + } + + // Brick + if(!found) + { + ItemSpec specs[9]; + specs[3] = ItemSpec(ITEM_CRAFT, "clay_brick"); + specs[4] = ItemSpec(ITEM_CRAFT, "clay_brick"); + specs[6] = ItemSpec(ITEM_CRAFT, "clay_brick"); + specs[7] = ItemSpec(ITEM_CRAFT, "clay_brick"); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_BRICK, 1)); + found = true; + } + } } } // if creative_mode == false @@ -4076,6 +4106,7 @@ void setCreativeInventory(Player *player) CONTENT_STONE, CONTENT_SAND, CONTENT_SANDSTONE, + CONTENT_CLAY, CONTENT_BRICK, CONTENT_TREE, CONTENT_LEAVES, diff --git a/src/tile.cpp b/src/tile.cpp index 361de704c..71e0c9638 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -507,6 +507,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("mud.png"); sourcelist.push_back("sand.png"); sourcelist.push_back("sandstone.png"); + sourcelist.push_back("clay.png"); sourcelist.push_back("brick.png"); sourcelist.push_back("grass.png"); sourcelist.push_back("grass_footsteps.png"); From c930a92b7222e0228332fb39536d7ff4f3442d1b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 08:09:28 +0200 Subject: [PATCH 17/40] * clay is rarer now --- src/map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index bf9f38c87..ac5bd7d14 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3144,9 +3144,9 @@ void makeChunk(ChunkMakeData *data) // Determine whether to have clay in the sand here double claynoise = noise2d_perlin( 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, - data->seed+4321, 8, 0.95); + data->seed+4321, 6, 0.95); - bool have_clay = have_sand && (claynoise > 0.95); + bool have_clay = have_sand && (claynoise > 1.25); // Find ground level s16 surface_y = find_ground_level_clever(data->vmanip, p2d); From d2b2c7c09e21fcf728e741e11e6fdabe03036b0e Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 08:56:23 +0800 Subject: [PATCH 18/40] * improved fence dimensions (cuboid side lengths now multiples of 2, textures should fit better) --- src/mapblock.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mapblock.cpp b/src/mapblock.cpp index c448ef236..d98bfaf1e 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1563,8 +1563,8 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio))); video::SColor c(255,l,l,l); - const f32 post_rad=(f32)BS/10; - const f32 bar_rad=(f32)BS/20; + const f32 post_rad=(f32)BS/(32.0/4.0); + const f32 bar_rad=(f32)BS/(32.0/2.0); const f32 bar_len=(f32)(BS/2)-post_rad; // The post - always present @@ -1581,12 +1581,12 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) { pos = intToFloat(p+blockpos_nodes, BS); pos.X += BS/2; - pos.Y += BS/4; + pos.Y += 3*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_len,bar_rad,bar_rad); - pos.Y -= BS/2; + pos.Y -= 6*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_len,bar_rad,bar_rad); @@ -1600,11 +1600,11 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) { pos = intToFloat(p+blockpos_nodes, BS); pos.Z += BS/2; - pos.Y += BS/4; + pos.Y += 3*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_rad,bar_rad,bar_len); - pos.Y -= BS/2; + pos.Y -= 6*bar_rad; makeCuboid(material_wood, &collector, &pa_wood, c, pos, bar_rad,bar_rad,bar_len); From 28234f6e54d91dbc8f3ec23b514a6d6ffe3a78a9 Mon Sep 17 00:00:00 2001 From: MrLoom Date: Wed, 1 Jun 2011 14:13:22 +0200 Subject: [PATCH 19/40] MacOSX build support --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5b8028f6..b1803bc9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ elseif(APPLE) set(CPACK_BUNDLE_ICON "") set(CPACK_BUNDLE_PLIST "") set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest") - set(CPACK_GENERATOR BUNDLE) + set(CPACK_GENERATOR "Bundle") else() set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux") set(CPACK_GENERATOR TGZ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49982d310..617a452b6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,13 +35,24 @@ else() find_package(JPEG REQUIRED) find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) + if(APPLE) + FIND_LIBRARY(CARBON_LIB Carbon) + FIND_LIBRARY(COCOA_LIB Cocoa) + FIND_LIBRARY(IOKIT_LIB IOKit) + mark_as_advanced( + CARBON_LIB + COCOA_LIB + IOKIT_LIB + ) + SET(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${CARBON_LIB} ${COCOA_LIB} ${IOKIT_LIB}) + endif(APPLE) endif(BUILD_CLIENT) find_package(ZLIB REQUIRED) set(PLATFORM_LIBS -lpthread) #set(CLIENT_PLATFORM_LIBS -lXxf86vm) # This way Xxf86vm is found on OpenBSD too find_library(XXF86VM_LIBRARY Xxf86vm) - set(CLIENT_PLATFORM_LIBS ${XXF86VM_LIBRARY}) + set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY}) endif() configure_file( @@ -174,8 +185,14 @@ else() set(WARNING_FLAGS "") endif() - set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable") - + if(NOT APPLE) + set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable") + endif() + if(APPLE) + set(CMAKE_OSX_ARCHITECTURES i386 CACHE STRING "do not build for 64-bit" FORCE) + set(ARCH i386) + endif() + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall") From 60578e0950d3235401d3a7504d602d5e398b7122 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 16:46:49 +0200 Subject: [PATCH 20/40] * README updated --- README | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index e3e3a3491..8a557adb4 100644 --- a/README +++ b/README @@ -1,7 +1,14 @@ Minetest Δ (“Minetest Delta”) is a fork of Minetest-c55 , incorporating experimental features that are not (yet) included in Minetest-c55. New bricks: -* Sandstone (crafted from 4 sand) +* Sandstone (crafted from 4 sand, yields sand) +* Cactus (plant that grows on sand) +* Clay (found in sand at sea level, yields 4 lumps of clay) +* Brick (made from 4 clay bricks, yields 4 clay bricks) + +New materials: +* Lump of clay +* Clay brick (made from lumps of clay in the furnace) Alternate graphics: * Player From a75c31143a9d26d06e298075dfd02465a9fdce69 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 17:19:28 +0200 Subject: [PATCH 21/40] * README updated --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 8a557adb4..70d110423 100644 --- a/README +++ b/README @@ -16,6 +16,6 @@ Alternate graphics: * Rat * Glass -Building on GNU/Linux: +Building on GNU/Linux or OS X: cmake . -DRUN_IN_PLACE=1 make -j2 From 58bc6f3a185712ef68a0f54c178e3124127fa75a Mon Sep 17 00:00:00 2001 From: teddydestodes Date: Wed, 1 Jun 2011 19:44:07 +0200 Subject: [PATCH 22/40] added new submenu for key assignment configwriting/saving isn't complete and will break your config if you use fancy keys --- src/CMakeLists.txt | 1 + src/guiKeyChangeMenu.cpp | 598 +++++++++++++++++++++++++++++++++++++++ src/guiKeyChangeMenu.h | 133 +++++++++ src/guiMainMenu.cpp | 71 +++-- src/guiMainMenu.h | 83 +++--- src/guiMessageMenu.h | 48 ++-- src/keycode.cpp | 78 +++-- src/keycode.h | 4 +- 8 files changed, 913 insertions(+), 103 deletions(-) create mode 100644 src/guiKeyChangeMenu.cpp create mode 100644 src/guiKeyChangeMenu.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 617a452b6..9d5cf7d2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,6 +100,7 @@ set(minetest_SRCS clientobject.cpp guiFurnaceMenu.cpp guiMainMenu.cpp + guiKeyChangeMenu.cpp guiMessageMenu.cpp guiTextInputMenu.cpp guiInventoryMenu.cpp diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp new file mode 100644 index 000000000..3e594aeca --- /dev/null +++ b/src/guiKeyChangeMenu.cpp @@ -0,0 +1,598 @@ +/* + Minetest-delta + Copyright (C) 2010-11 celeron55, Perttu Ahola + Copyright (C) 2011 Ciaran Gultnieks + Copyright (C) 2011 teddydestodes + + 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 + (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. + + You should have received a copy of the GNU 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 "guiKeyChangeMenu.h" +#include "debug.h" +#include "serialization.h" +#include "keycode.h" +#include "main.h" +#include + +GUIKeyChangeMenu::GUIKeyChangeMenu(gui::IGUIEnvironment* env, + gui::IGUIElement* parent, s32 id, IMenuManager *menumgr) : + GUIModalMenu(env, parent, id, menumgr) +{ + activeKey = -1; + init_keys(); +} + +GUIKeyChangeMenu::~GUIKeyChangeMenu() +{ + removeChildren(); +} + +void GUIKeyChangeMenu::removeChildren() +{ + const core::list &children = getChildren(); + core::list children_copy; + for (core::list::ConstIterator i = children.begin(); i + != children.end(); i++) + { + children_copy.push_back(*i); + } + for (core::list::Iterator i = children_copy.begin(); i + != children_copy.end(); i++) + { + (*i)->remove(); + } +} + +void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) +{ + /* + Remove stuff + */ + removeChildren(); + + /* + Calculate new sizes and positions + */ + + v2s32 size(620, 430); + + core::rect < s32 > rect(screensize.X / 2 - size.X / 2, + screensize.Y / 2 - size.Y / 2, screensize.X / 2 + size.X / 2, + screensize.Y / 2 + size.Y / 2); + + DesiredRect = rect; + recalculateAbsolutePosition(false); + + v2s32 topleft(0, 0); + + { + core::rect < s32 > rect(0, 0, 125, 20); + rect += topleft + v2s32(25, 3); + const wchar_t *text = L"KEYBINDINGS"; + //gui::IGUIStaticText *t = + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + v2s32 offset(25, 40); + // buttons + + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Forward"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->forward = Environment->addButton(rect, this, + GUI_ID_KEY_FORWARD_BUTTON, + narrow_to_wide(KeyNames[key_forward]).c_str()); + } + + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Backward"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->backward = Environment->addButton(rect, this, + GUI_ID_KEY_BACKWARD_BUTTON, + narrow_to_wide(KeyNames[key_backward]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Left"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->left = Environment->addButton(rect, this, GUI_ID_KEY_LEFT_BUTTON, + narrow_to_wide(KeyNames[key_left]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Right"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->right = Environment->addButton(rect, this, + GUI_ID_KEY_RIGHT_BUTTON, + narrow_to_wide(KeyNames[key_right]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Use"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->use = Environment->addButton(rect, this, GUI_ID_KEY_USE_BUTTON, + narrow_to_wide(KeyNames[key_use]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Sneak"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->sneak = Environment->addButton(rect, this, + GUI_ID_KEY_SNEAK_BUTTON, + narrow_to_wide(KeyNames[key_sneak]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Jump"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->jump = Environment->addButton(rect, this, GUI_ID_KEY_JUMP_BUTTON, + narrow_to_wide(KeyNames[key_jump]).c_str()); + } + + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Inventory"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->inventory = Environment->addButton(rect, this, + GUI_ID_KEY_INVENTORY_BUTTON, + narrow_to_wide(KeyNames[key_inventory]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Chat"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->chat = Environment->addButton(rect, this, GUI_ID_KEY_CHAT_BUTTON, + narrow_to_wide(KeyNames[key_chat]).c_str()); + } + + //next col + offset = v2s32(250, 40); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Toggle fly"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->fly = Environment->addButton(rect, this, GUI_ID_KEY_FLY_BUTTON, + narrow_to_wide(KeyNames[key_fly]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Toggle fast"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->fast = Environment->addButton(rect, this, GUI_ID_KEY_FAST_BUTTON, + narrow_to_wide(KeyNames[key_fast]).c_str()); + } + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Range select"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->range = Environment->addButton(rect, this, + GUI_ID_KEY_RANGE_BUTTON, + narrow_to_wide(KeyNames[key_range]).c_str()); + } + + offset += v2s32(0, 25); + { + core::rect < s32 > rect(0, 0, 100, 20); + rect += topleft + v2s32(offset.X, offset.Y); + const wchar_t *text = L"Print stacks"; + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(offset.X + 105, offset.Y - 5); + this->dump = Environment->addButton(rect, this, GUI_ID_KEY_DUMP_BUTTON, + narrow_to_wide(KeyNames[key_dump]).c_str()); + } + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(size.X - 100 - 20, size.Y - 40); + Environment->addButton(rect, this, GUI_ID_BACK_BUTTON, L"Save"); + } + { + core::rect < s32 > rect(0, 0, 100, 30); + rect += topleft + v2s32(size.X - 100 - 20 - 100 - 20, size.Y - 40); + Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON, L"Cancel"); + } +} + +void GUIKeyChangeMenu::drawMenu() +{ + gui::IGUISkin* skin = Environment->getSkin(); + if (!skin) + return; + video::IVideoDriver* driver = Environment->getVideoDriver(); + + video::SColor bgcolor(140, 0, 0, 0); + + { + core::rect < s32 > rect(0, 0, 620, 620); + rect += AbsoluteRect.UpperLeftCorner; + driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect); + } + + gui::IGUIElement::draw(); +} + +bool GUIKeyChangeMenu::acceptInput() +{ + g_settings.set("keymap_forward", keycode_to_keyname(key_forward)); + g_settings.set("keymap_backward", keycode_to_keyname(key_backward)); + g_settings.set("keymap_left", keycode_to_keyname(key_left)); + g_settings.set("keymap_right", keycode_to_keyname(key_right)); + g_settings.set("keymap_jump", keycode_to_keyname(key_jump)); + g_settings.set("keymap_sneak", keycode_to_keyname(key_sneak)); + g_settings.set("keymap_inventory", keycode_to_keyname(key_inventory)); + g_settings.set("keymap_chat", keycode_to_keyname(key_chat)); + g_settings.set("keymap_rangeselect", keycode_to_keyname(key_range)); + g_settings.set("keymap_freemove", keycode_to_keyname(key_fly)); + g_settings.set("keymap_fastmove", keycode_to_keyname(key_fast)); + g_settings.set("keymap_special1", keycode_to_keyname(key_use)); + g_settings.set("keymap_print_debug_stacks", keycode_to_keyname(key_dump)); + //clearKeyCache(); Y U NO SCOPE?! + return true; +} +void GUIKeyChangeMenu::init_keys() +{ + key_forward = getKeySetting("keymap_forward"); + key_backward = getKeySetting("keymap_backward"); + key_left = getKeySetting("keymap_left"); + key_right = getKeySetting("keymap_right"); + key_jump = getKeySetting("keymap_jump"); + key_sneak = getKeySetting("keymap_sneak"); + key_inventory = getKeySetting("keymap_inventory"); + key_chat = getKeySetting("keymap_chat"); + key_range = getKeySetting("keymap_rangeselect"); + key_fly = getKeySetting("keymap_freemove"); + key_fast = getKeySetting("keymap_fastmove"); + key_use = getKeySetting("keymap_special1"); + key_dump = getKeySetting("keymap_print_debug_stacks"); +} + +bool GUIKeyChangeMenu::resetMenu() +{ + if (activeKey >= 0) + { + switch (activeKey) + { + case GUI_ID_KEY_FORWARD_BUTTON: + this->forward->setText( + narrow_to_wide(KeyNames[key_forward]).c_str()); + break; + case GUI_ID_KEY_BACKWARD_BUTTON: + this->backward->setText( + narrow_to_wide(KeyNames[key_backward]).c_str()); + break; + case GUI_ID_KEY_LEFT_BUTTON: + this->left->setText(narrow_to_wide(KeyNames[key_left]).c_str()); + break; + case GUI_ID_KEY_RIGHT_BUTTON: + this->right->setText(narrow_to_wide(KeyNames[key_right]).c_str()); + break; + case GUI_ID_KEY_JUMP_BUTTON: + this->jump->setText(narrow_to_wide(KeyNames[key_jump]).c_str()); + break; + case GUI_ID_KEY_SNEAK_BUTTON: + this->sneak->setText(narrow_to_wide(KeyNames[key_sneak]).c_str()); + break; + case GUI_ID_KEY_INVENTORY_BUTTON: + this->inventory->setText( + narrow_to_wide(KeyNames[key_inventory]).c_str()); + break; + case GUI_ID_KEY_CHAT_BUTTON: + this->chat->setText(narrow_to_wide(KeyNames[key_chat]).c_str()); + break; + case GUI_ID_KEY_RANGE_BUTTON: + this->range->setText(narrow_to_wide(KeyNames[key_range]).c_str()); + break; + case GUI_ID_KEY_FLY_BUTTON: + this->fly->setText(narrow_to_wide(KeyNames[key_fly]).c_str()); + break; + case GUI_ID_KEY_FAST_BUTTON: + this->fast->setText(narrow_to_wide(KeyNames[key_fast]).c_str()); + break; + case GUI_ID_KEY_USE_BUTTON: + this->use->setText(narrow_to_wide(KeyNames[key_use]).c_str()); + break; + case GUI_ID_KEY_DUMP_BUTTON: + this->dump->setText(narrow_to_wide(KeyNames[key_dump]).c_str()); + break; + } + activeKey = -1; + return false; + } + return true; +} +bool GUIKeyChangeMenu::OnEvent(const SEvent& event) +{ + if (event.EventType == EET_KEY_INPUT_EVENT && activeKey >= 0 + && event.KeyInput.PressedDown) + { + if (activeKey == GUI_ID_KEY_FORWARD_BUTTON) + { + this->forward->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_forward = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_BACKWARD_BUTTON) + { + this->backward->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_backward = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_LEFT_BUTTON) + { + this->left->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_left = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_RIGHT_BUTTON) + { + this->right->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_right = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_JUMP_BUTTON) + { + this->jump->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_jump = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_SNEAK_BUTTON) + { + this->sneak->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_sneak = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_INVENTORY_BUTTON) + { + this->inventory->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_inventory = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_CHAT_BUTTON) + { + this->chat->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_chat = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_RANGE_BUTTON) + { + this->range->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_range = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_FLY_BUTTON) + { + this->fly->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_fly = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_FAST_BUTTON) + { + this->fast->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_fast = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_USE_BUTTON) + { + this->use->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_use = event.KeyInput.Key; + } + else if (activeKey == GUI_ID_KEY_DUMP_BUTTON) + { + this->dump->setText( + narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str()); + this->key_dump = event.KeyInput.Key; + } + + activeKey = -1; + return true; + } + if (event.EventType == EET_GUI_EVENT) + { + if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST + && isVisible()) + { + if (!canTakeFocus(event.GUIEvent.Element)) + { + dstream << "GUIMainMenu: Not allowing focus change." + << std::endl; + // Returning true disables focus change + return true; + } + } + if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) + { + switch (event.GUIEvent.Caller->getID()) + { + case GUI_ID_BACK_BUTTON: //back + acceptInput(); + quitMenu(); + return true; + case GUI_ID_ABORT_BUTTON: //abort + quitMenu(); + return true; + case GUI_ID_KEY_FORWARD_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->forward->setText(L"press Key"); + break; + case GUI_ID_KEY_BACKWARD_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->backward->setText(L"press Key"); + break; + case GUI_ID_KEY_LEFT_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->left->setText(L"press Key"); + break; + case GUI_ID_KEY_RIGHT_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->right->setText(L"press Key"); + break; + case GUI_ID_KEY_USE_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->use->setText(L"press Key"); + break; + case GUI_ID_KEY_FLY_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->fly->setText(L"press Key"); + break; + case GUI_ID_KEY_FAST_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->fast->setText(L"press Key"); + break; + case GUI_ID_KEY_JUMP_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->jump->setText(L"press Key"); + break; + case GUI_ID_KEY_CHAT_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->chat->setText(L"press Key"); + break; + case GUI_ID_KEY_SNEAK_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->sneak->setText(L"press Key"); + break; + case GUI_ID_KEY_INVENTORY_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->inventory->setText(L"press Key"); + break; + case GUI_ID_KEY_DUMP_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->dump->setText(L"press Key"); + break; + case GUI_ID_KEY_RANGE_BUTTON: + resetMenu(); + activeKey = event.GUIEvent.Caller->getID(); + this->range->setText(L"press Key"); + break; + } + //Buttons + + } + } + return Parent ? Parent->OnEvent(event) : false; +} + diff --git a/src/guiKeyChangeMenu.h b/src/guiKeyChangeMenu.h new file mode 100644 index 000000000..389ce7aee --- /dev/null +++ b/src/guiKeyChangeMenu.h @@ -0,0 +1,133 @@ +/* + Minetest-delta + Copyright (C) 2010-11 celeron55, Perttu Ahola + Copyright (C) 2011 Ciaran Gultnieks + Copyright (C) 2011 teddydestodes + + 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 + (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. + + You should have received a copy of the GNU 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. + */ + +#ifndef GUIKEYCHANGEMENU_HEADER +#define GUIKEYCHANGEMENU_HEADER + +#include "common_irrlicht.h" +#include "utility.h" +#include "modalMenu.h" +#include "client.h" +#include + +static const char *KeyNames[] = + { "-", "Left Button", "Right Button", "Cancel", "Middle Button", "X Button 1", + "X Button 2", "-", "Back", "Tab", "-", "-", "Clear", "Return", "-", + "-", "Shift", "Control", "Menu", "Pause", "Capital", "Kana", "-", + "Junja", "Final", "Kanji", "-", "Escape", "Convert", "Nonconvert", + "Accept", "Mode Change", "Space", "Priot", "Next", "End", "Home", + "Left", "Up", "Right", "Down", "Select", "Print", "Execute", + "Snapshot", "Insert", "Delete", "Help", "0", "1", "2", "3", "4", "5", + "6", "7", "8", "9", "-", "-", "-", "-", "-", "-", "-", "A", "B", "C", + "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", + "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Left Windows", + "Right Windows", "Apps", "-", "Sleep", "Numpad 0", "Numpad 1", + "Numpad 2", "Numpad 3", "Numpad 4", "Numpad 5", "Numpad 6", "Numpad 7", + "Numpad 8", "Numpad 9", "Numpad *", "Numpad +", "Numpad /", "Numpad -", + "Numpad .", "Numpad /", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", + "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", + "F19", "F20", "F21", "F22", "F23", "F24", "-", "-", "-", "-", "-", "-", + "-", "-", "Num Lock", "Scroll Lock", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "Left Shift", "Right Shight", + "Left Control", "Right Control", "Left Menu", "Right Menu", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "Plus", "Comma", "Minus", "Period", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "Attn", "CrSel", + "ExSel", "Erase OEF", "Play", "Zoom", "PA1", "OEM Clear", "-" }; + enum + { + GUI_ID_BACK_BUTTON = 101, GUI_ID_ABORT_BUTTON, GUI_ID_SCROLL_BAR, + //buttons + GUI_ID_KEY_FORWARD_BUTTON, + GUI_ID_KEY_BACKWARD_BUTTON, + GUI_ID_KEY_LEFT_BUTTON, + GUI_ID_KEY_RIGHT_BUTTON, + GUI_ID_KEY_USE_BUTTON, + GUI_ID_KEY_FLY_BUTTON, + GUI_ID_KEY_FAST_BUTTON, + GUI_ID_KEY_JUMP_BUTTON, + GUI_ID_KEY_CHAT_BUTTON, + GUI_ID_KEY_SNEAK_BUTTON, + GUI_ID_KEY_INVENTORY_BUTTON, + GUI_ID_KEY_DUMP_BUTTON, + GUI_ID_KEY_RANGE_BUTTON + }; + +class GUIKeyChangeMenu: public GUIModalMenu +{ +public: + GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, + s32 id, IMenuManager *menumgr); + ~GUIKeyChangeMenu(); + + void removeChildren(); + /* + Remove and re-add (or reposition) stuff + */ + void regenerateGui(v2u32 screensize); + + void drawMenu(); + + bool acceptInput(); + + bool OnEvent(const SEvent& event); + +private: + + void init_keys(); + + bool resetMenu(); + + gui::IGUIButton *forward; + gui::IGUIButton *backward; + gui::IGUIButton *left; + gui::IGUIButton *right; + gui::IGUIButton *use; + gui::IGUIButton *sneak; + gui::IGUIButton *jump; + gui::IGUIButton *inventory; + gui::IGUIButton *fly; + gui::IGUIButton *fast; + gui::IGUIButton *range; + gui::IGUIButton *dump; + gui::IGUIButton *chat; + + u32 activeKey; + u32 key_forward; + u32 key_backward; + u32 key_left; + u32 key_right; + u32 key_use; + u32 key_sneak; + u32 key_jump; + u32 key_inventory; + u32 key_fly; + u32 key_fast; + u32 key_range; + u32 key_chat; + u32 key_dump; +}; + +#endif + diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index a30e006a6..cea32860b 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -18,10 +18,13 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "guiMainMenu.h" +#include "guiKeyChangeMenu.h" #include "debug.h" #include "serialization.h" #include + + GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, @@ -34,6 +37,10 @@ GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env, m_gamecallback(gamecallback) { assert(m_data); + this->env = env; + this->parent = parent; + this->id = id; + this->menumgr = menumgr; } GUIMainMenu::~GUIMainMenu() @@ -70,35 +77,35 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) // Client options { - gui::IGUIElement *e = getElementFromId(258); + gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT); if(e != NULL) text_name = e->getText(); else text_name = m_data->name; } { - gui::IGUIElement *e = getElementFromId(256); + gui::IGUIElement *e = getElementFromId(GUI_ID_ADDRESS_INPUT); if(e != NULL) text_address = e->getText(); else text_address = m_data->address; } { - gui::IGUIElement *e = getElementFromId(257); + gui::IGUIElement *e = getElementFromId(GUI_ID_PORT_INPUT); if(e != NULL) text_port = e->getText(); else text_port = m_data->port; } { - gui::IGUIElement *e = getElementFromId(263); + gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) fancy_trees = ((gui::IGUICheckBox*)e)->isChecked(); else fancy_trees = m_data->fancy_trees; } { - gui::IGUIElement *e = getElementFromId(262); + gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked(); else @@ -107,14 +114,14 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) // Server options { - gui::IGUIElement *e = getElementFromId(259); + gui::IGUIElement *e = getElementFromId(GUI_ID_CREATIVE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) creative_mode = ((gui::IGUICheckBox*)e)->isChecked(); else creative_mode = m_data->creative_mode; } { - gui::IGUIElement *e = getElementFromId(261); + gui::IGUIElement *e = getElementFromId(GUI_ID_DAMAGE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) enable_damage = ((gui::IGUICheckBox*)e)->isChecked(); else @@ -175,7 +182,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, 50); gui::IGUIElement *e = - Environment->addEditBox(text_name.c_str(), rect, true, this, 258); + Environment->addEditBox(text_name.c_str(), rect, true, this, GUI_ID_NAME_INPUT); if(text_name == L"") Environment->setFocus(e); } @@ -198,7 +205,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, 100); gui::IGUIElement *e = - Environment->addEditBox(text_address.c_str(), rect, true, this, 256); + Environment->addEditBox(text_address.c_str(), rect, true, this, GUI_ID_ADDRESS_INPUT); if(text_name != L"") Environment->setFocus(e); } @@ -206,7 +213,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 120, 30); //rect += topleft_client + v2s32(160+250+20, 125); rect += topleft_client + v2s32(size_client.X-60-100, 100); - Environment->addEditBox(text_port.c_str(), rect, true, this, 257); + Environment->addEditBox(text_port.c_str(), rect, true, this, GUI_ID_PORT_INPUT); } { core::rect rect(0, 0, 400, 20); @@ -217,13 +224,13 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 250, 30); rect += topleft_client + v2s32(35, 150); - Environment->addCheckBox(fancy_trees, rect, this, 263, + Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, L"Fancy trees"); } { core::rect rect(0, 0, 250, 30); rect += topleft_client + v2s32(35, 150+30); - Environment->addCheckBox(smooth_lighting, rect, this, 262, + Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, L"Smooth Lighting"); } // Start game button @@ -231,9 +238,16 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 180, 30); //rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2); rect += topleft_client + v2s32(size_client.X-180-40, 150+25); - Environment->addButton(rect, this, 257, L"Start Game / Connect"); + Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, L"Start Game / Connect"); } + // Key change button + { + core::rect rect(0, 0, 100, 30); + //rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2); + rect += topleft_client + v2s32(size_client.X-180-40-100-20, 150+25); + Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, L"Change keys"); + } /* Server section */ @@ -254,19 +268,19 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 250, 30); rect += topleft_server + v2s32(35, 30); - Environment->addCheckBox(creative_mode, rect, this, 259, L"Creative Mode"); + Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, L"Creative Mode"); } { core::rect rect(0, 0, 250, 30); rect += topleft_server + v2s32(35, 60); - Environment->addCheckBox(enable_damage, rect, this, 261, L"Enable Damage"); + Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, L"Enable Damage"); } // Map delete button { core::rect rect(0, 0, 130, 30); //rect += topleft_server + v2s32(size_server.X-40-130, 100+25); rect += topleft_server + v2s32(40, 100+25); - Environment->addButton(rect, this, 260, L"Delete map"); + Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, L"Delete map"); } } @@ -300,7 +314,7 @@ void GUIMainMenu::drawMenu() void GUIMainMenu::acceptInput() { { - gui::IGUIElement *e = getElementFromId(258); + gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT); if(e != NULL) m_data->name = e->getText(); } @@ -310,32 +324,32 @@ void GUIMainMenu::acceptInput() m_data->password = e->getText(); } { - gui::IGUIElement *e = getElementFromId(256); + gui::IGUIElement *e = getElementFromId(GUI_ID_ADDRESS_INPUT); if(e != NULL) m_data->address = e->getText(); } { - gui::IGUIElement *e = getElementFromId(257); + gui::IGUIElement *e = getElementFromId(GUI_ID_PORT_INPUT); if(e != NULL) m_data->port = e->getText(); } { - gui::IGUIElement *e = getElementFromId(259); + gui::IGUIElement *e = getElementFromId(GUI_ID_CREATIVE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) m_data->creative_mode = ((gui::IGUICheckBox*)e)->isChecked(); } { - gui::IGUIElement *e = getElementFromId(261); + gui::IGUIElement *e = getElementFromId(GUI_ID_DAMAGE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked(); } { - gui::IGUIElement *e = getElementFromId(262); + gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) m_data->smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked(); } { - gui::IGUIElement *e = getElementFromId(263); + gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked(); } @@ -377,11 +391,16 @@ bool GUIMainMenu::OnEvent(const SEvent& event) { switch(event.GUIEvent.Caller->getID()) { - case 257: // Start game + case GUI_ID_JOIN_GAME_BUTTON: // Start game acceptInput(); quitMenu(); return true; - case 260: // Delete map + case GUI_ID_CHANGE_KEYS_BUTTON: { + GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(env, parent, -1,menumgr); + kmenu->drop(); + return true; + } + case GUI_ID_DELETE_MAP_BUTTON: // Delete map // Don't accept input data, just set deletion request m_data->delete_map = true; m_accepted = true; @@ -393,7 +412,7 @@ bool GUIMainMenu::OnEvent(const SEvent& event) { switch(event.GUIEvent.Caller->getID()) { - case 256: case 257: case 258: case 264: + case GUI_ID_ADDRESS_INPUT: case GUI_ID_PORT_INPUT: case GUI_ID_NAME_INPUT: case 264: acceptInput(); quitMenu(); return true; diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h index edd519024..6c028c6e5 100644 --- a/src/guiMainMenu.h +++ b/src/guiMainMenu.h @@ -1,21 +1,21 @@ /* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola + Minetest-c55 + Copyright (C) 2010 celeron55, Perttu Ahola -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 -(at your option) any later version. + 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 + (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. + 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. -You should have received a copy of the GNU 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. -*/ + You should have received a copy of the GNU 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. + */ #ifndef GUIMAINMENU_HEADER #define GUIMAINMENU_HEADER @@ -27,21 +27,35 @@ with this program; if not, write to the Free Software Foundation, Inc., // For IGameCallback #include "guiPauseMenu.h" +enum +{ + GUI_ID_QUIT_BUTTON = 101, + GUI_ID_NAME_INPUT, + GUI_ID_ADDRESS_INPUT, + GUI_ID_PORT_INPUT, + GUI_ID_FANCYTREE_CB, + GUI_ID_SMOOTH_LIGHTING_CB, + GUI_ID_DAMAGE_CB, + GUI_ID_CREATIVE_CB, + GUI_ID_JOIN_GAME_BUTTON, + GUI_ID_CHANGE_KEYS_BUTTON, + GUI_ID_DELETE_MAP_BUTTON +}; + struct MainMenuData { - MainMenuData(): + MainMenuData() : // Client opts - fancy_trees(false), - smooth_lighting(false), - // Server opts - creative_mode(false), - enable_damage(false), - // Actions - delete_map(false) - {} + fancy_trees(false), smooth_lighting(false), + // Server opts + creative_mode(false), enable_damage(false), + // Actions + delete_map(false) + { + } // These are in the native format of the gui elements - + // Client options std::wstring address; std::wstring port; @@ -56,20 +70,23 @@ struct MainMenuData bool delete_map; }; -class GUIMainMenu : public GUIModalMenu +class GUIMainMenu: public GUIModalMenu { public: - GUIMainMenu(gui::IGUIEnvironment* env, - gui::IGUIElement* parent, s32 id, - IMenuManager *menumgr, - MainMenuData *data, + GUIMainMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, + IMenuManager *menumgr, MainMenuData *data, IGameCallback *gamecallback); ~GUIMainMenu(); - + + gui::IGUIEnvironment* env; + gui::IGUIElement* parent; + s32 id; + IMenuManager *menumgr; + void removeChildren(); /* - Remove and re-add (or reposition) stuff - */ + Remove and re-add (or reposition) stuff + */ void regenerateGui(v2u32 screensize); void drawMenu(); @@ -82,7 +99,7 @@ public: } bool OnEvent(const SEvent& event); - + private: MainMenuData *m_data; bool m_accepted; diff --git a/src/guiMessageMenu.h b/src/guiMessageMenu.h index 82c40ce09..8f48b6626 100644 --- a/src/guiMessageMenu.h +++ b/src/guiMessageMenu.h @@ -1,21 +1,21 @@ /* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola + Minetest-c55 + Copyright (C) 2010 celeron55, Perttu Ahola -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 -(at your option) any later version. + 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 + (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. + 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. -You should have received a copy of the GNU 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. -*/ + You should have received a copy of the GNU 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. + */ #ifndef GUIMESSAGEMENU_HEADER #define GUIMESSAGEMENU_HEADER @@ -25,19 +25,17 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "utility.h" #include -class GUIMessageMenu : public GUIModalMenu +class GUIMessageMenu: public GUIModalMenu { public: - GUIMessageMenu(gui::IGUIEnvironment* env, - gui::IGUIElement* parent, s32 id, - IMenuManager *menumgr, - std::wstring message_text); + GUIMessageMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, + IMenuManager *menumgr, std::wstring message_text); ~GUIMessageMenu(); - + void removeChildren(); /* - Remove and re-add (or reposition) stuff - */ + Remove and re-add (or reposition) stuff + */ void regenerateGui(v2u32 screensize); void drawMenu(); @@ -45,13 +43,13 @@ public: bool OnEvent(const SEvent& event); /* - true = ok'd - */ + true = ok'd + */ bool getStatus() { return m_status; } - + private: std::wstring m_message_text; bool m_status; diff --git a/src/keycode.cpp b/src/keycode.cpp index ad3c0b401..993426053 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -1,25 +1,24 @@ /* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola + Minetest-c55 + Copyright (C) 2010-2011 celeron55, Perttu Ahola -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 -(at your option) any later version. + 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 + (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. + 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. -You should have received a copy of the GNU 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. -*/ + You should have received a copy of the GNU 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 "keycode.h" #include "main.h" // For g_settings - #define CHECKKEY(x){if(strcmp(name, #x)==0) return irr::x;} irr::EKEY_CODE keyname_to_keycode(const char *name) @@ -171,9 +170,48 @@ irr::EKEY_CODE keyname_to_keycode(const char *name) return irr::KEY_KEY_CODES_COUNT; } +static const char *KeyNames[] = +{ "-", "KEY_LBUTTON", "KEY_RBUTTON", "Cancel", "Middle Button", "X Button 1", + "X Button 2", "-", "Back", "Tab", "-", "-", "Clear", "Return", "-", + "-", "KEY_SHIFT", "Control", "Menu", "Pause", "Capital", "Kana", "-", + "Junja", "Final", "Kanji", "-", "Escape", "Convert", "Nonconvert", + "Accept", "Mode Change", "KEY_SPACE", "Priot", "Next", "KEY_END", + "KEY_HOME", "Left", "Up", "Right", "Down", "Select", "KEY_PRINT", + "Execute", "Snapshot", "Insert", "Delete", "Help", "KEY_KEY_0", + "KEY_KEY_1", "KEY_KEY_2", "KEY_KEY_3", "KEY_KEY_4", "KEY_KEY_5", + "KEY_KEY_6", "KEY_KEY_7", "KEY_KEY_8", "KEY_KEY_9", "-", "-", "-", "-", + "-", "-", "-", "KEY_KEY_A", "KEY_KEY_B", "KEY_KEY_C", "KEY_KEY_D", + "KEY_KEY_E", "KEY_KEY_F", "KEY_KEY_G", "KEY_KEY_H", "KEY_KEY_I", + "KEY_KEY_J", "KEY_KEY_K", "KEY_KEY_L", "KEY_KEY_M", "KEY_KEY_N", + "KEY_KEY_O", "KEY_KEY_P", "KEY_KEY_Q", "KEY_KEY_R", "KEY_KEY_S", + "KEY_KEY_T", "KEY_KEY_U", "KEY_KEY_V", "KEY_KEY_W", "KEY_KEY_X", + "KEY_KEY_Y", "KEY_KEY_Z", "Left Windows", "Right Windows", "Apps", "-", + "Sleep", "KEY_NUMPAD0", "KEY_NUMPAD1", "KEY_NUMPAD2", "KEY_NUMPAD3", + "KEY_NUMPAD4", "KEY_NUMPAD5", "KEY_NUMPAD6", "KEY_NUMPAD7", + "KEY_NUMPAD8", "KEY_NUMPAD9", "Numpad *", "Numpad +", "Numpad /", + "Numpad -", "Numpad .", "Numpad /", "KEY_F1", "KEY_F2", "KEY_F3", + "KEY_F4", "KEY_F5", "KEY_F6", "KEY_F7", "KEY_F8", "KEY_F9", "KEY_F10", + "KEY_F11", "KEY_F12", "KEY_F13", "KEY_F14", "KEY_F15", "KEY_F16", + "KEY_F17", "KEY_F18", "KEY_F19", "KEY_F20", "KEY_F21", "KEY_F22", + "KEY_F23", "KEY_F24", "-", "-", "-", "-", "-", "-", "-", "-", + "Num Lock", "Scroll Lock", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "KEY_LSHIFT", "KEY_RSHIFT", "Left Control", + "Right Control", "Left Menu", "Right Menu", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "Plus", "Comma", "Minus", "Period", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", + "-", "-", "-", "-", "-", "-", "-", "-", "Attn", "CrSel", "ExSel", + "Erase OEF", "Play", "Zoom", "PA1", "OEM Clear", "-" }; + +std::string keycode_to_keyname(s32 keycode) +{ + return KeyNames[keycode]; +} /* - Key config -*/ + Key config + */ // A simple cache for quicker lookup core::map g_key_setting_cache; @@ -182,11 +220,15 @@ irr::EKEY_CODE getKeySetting(const char *settingname) { core::map::Node *n; n = g_key_setting_cache.find(settingname); - if(n) + if (n) return n->getValue(); irr::EKEY_CODE c = keyname_to_keycode(g_settings.get(settingname).c_str()); g_key_setting_cache.insert(settingname, c); return c; } +void clearKeyCache() +{ + g_key_setting_cache.clear(); +} diff --git a/src/keycode.h b/src/keycode.h index f19fe3442..614f2e584 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -21,11 +21,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #define KEYCODE_HEADER #include "common_irrlicht.h" +#include irr::EKEY_CODE keyname_to_keycode(const char *name); // Key configuration getter irr::EKEY_CODE getKeySetting(const char *settingname); - +std::string keycode_to_keyname(s32 keycode); +void clearCache(); #endif From 4800f1df974e78d4bd9de36a2ff8478771d6fedf Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 03:03:47 +0200 Subject: [PATCH 23/40] * README updated --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 70d110423..4610ed141 100644 --- a/README +++ b/README @@ -1,5 +1,8 @@ Minetest Δ (“Minetest Delta”) is a fork of Minetest-c55 , incorporating experimental features that are not (yet) included in Minetest-c55. +New features: +* Submenu for key assignment (changes apply after restart) + New bricks: * Sandstone (crafted from 4 sand, yields sand) * Cactus (plant that grows on sand) From 4b2b65df9ff9903e64a2831be7411bc9a3afd8be Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:17:50 +0200 Subject: [PATCH 24/40] =?UTF-8?q?+=20minetestmapper2,=20colors=20modified?= =?UTF-8?q?=20for=20Minetest=20=CE=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- minetestmapper/colors.txt | 22 +++ minetestmapper/minetestmapper2.py | 272 ++++++++++++++++++++++++++++++ 2 files changed, 294 insertions(+) create mode 100644 minetestmapper/colors.txt create mode 100755 minetestmapper/minetestmapper2.py diff --git a/minetestmapper/colors.txt b/minetestmapper/colors.txt new file mode 100644 index 000000000..a7f8a36e4 --- /dev/null +++ b/minetestmapper/colors.txt @@ -0,0 +1,22 @@ +0 128 128 128 +1 107 134 51 +2 39 66 106 +3 255 255 0 +4 86 58 31 +5 48 95 8 +6 102 129 38 +7 178 178 0 +8 101 84 36 +9 39 66 106 +12 104 78 42 +13 210 194 156 +14 117 86 41 +15 128 79 0 +16 118 118 118 +18 123 123 123 +19 199 199 199 +20 183 183 222 +21 103 78 42 +23 115 210 22 +24 204 0 0 +25 211 215 207 diff --git a/minetestmapper/minetestmapper2.py b/minetestmapper/minetestmapper2.py new file mode 100755 index 000000000..f9b681bfb --- /dev/null +++ b/minetestmapper/minetestmapper2.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# -*- coding: windows-1252 -*- + +# Made by j0gge, modified by celeron55 + +# This program is free software. It comes without any warranty, to +# the extent permitted by applicable law. You can redistribute it +# and/or modify it under the terms of the Do What The Fuck You Want +# To Public License, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. + +# Requires Python Imaging Library: http://www.pythonware.com/products/pil/ + +# Some speed-up: ...lol, actually it slows it down. +#import psyco ; psyco.full() +#from psyco.classes import * + +import zlib +import Image, ImageDraw +import os +import string +import time + +def hex_to_int(h): + i = int(h,16) + if(i > 2047): + i-=4096 + return i + +def hex4_to_int(h): + i = int(h,16) + if(i > 32767): + i-=65536 + return i + +def int_to_hex3(i): + if(i < 0): + return "%03X" % (i + 4096) + else: + return "%03X" % i + +def int_to_hex4(i): + if(i < 0): + return "%04X" % (i + 65536) + else: + return "%04X" % i + +def limit(i,l,h): + if(i>h): + i=h + if(i sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + xlist.append(x) + zlist.append(z) +for filename in os.listdir(path + "sectors"): + x = hex4_to_int(filename[:4]) + z = hex4_to_int(filename[-4:]) + if x < sector_xmin or x > sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + xlist.append(x) + zlist.append(z) + +w = (max(xlist) - min(xlist)) * 16 + 16 +h = (max(zlist) - min(zlist)) * 16 + 16 + +print "w="+str(w)+" h="+str(h) + +im = Image.new("RGB", (w, h), "white") +impix = im.load() + +stuff={} + +starttime = time.time() + +# Go through all sectors. +for n in range(len(xlist)): + #if n > 500: + # break + if n % 200 == 0: + nowtime = time.time() + dtime = nowtime - starttime + n_per_second = 1.0 * n / dtime + if n_per_second != 0: + seconds_per_n = 1.0 / n_per_second + time_guess = seconds_per_n * len(xlist) + remaining_s = time_guess - dtime + remaining_minutes = int(remaining_s / 60) + remaining_s -= remaining_minutes * 60; + print("Processing sector "+str(n)+" of "+str(len(xlist)) + +" ("+str(round(100.0*n/len(xlist), 1))+"%)" + +" (ETA: "+str(remaining_minutes)+"m " + +str(int(remaining_s))+"s)") + + xpos = xlist[n] + zpos = zlist[n] + + xhex = int_to_hex3(xpos) + zhex = int_to_hex3(zpos) + xhex4 = int_to_hex4(xpos) + zhex4 = int_to_hex4(zpos) + + sector1 = xhex4.lower() + zhex4.lower() + sector2 = xhex.lower() + "/" + zhex.lower() + + ylist=[] + + sectortype = "" + + try: + for filename in os.listdir(path + "sectors/" + sector1): + if(filename != "meta"): + pos = int(filename,16) + if(pos > 32767): + pos-=65536 + ylist.append(pos) + sectortype = "old" + except OSError: + pass + + if sectortype != "old": + try: + for filename in os.listdir(path + "sectors2/" + sector2): + if(filename != "meta"): + pos = int(filename,16) + if(pos > 32767): + pos-=65536 + ylist.append(pos) + sectortype = "new" + except OSError: + pass + + if sectortype == "": + continue + + ylist.sort() + + # Make a list of pixels of the sector that are to be looked for. + pixellist = [] + for x in range(16): + for y in range(16): + pixellist.append((x,y)) + + # Go through the Y axis from top to bottom. + for ypos in reversed(ylist): + + yhex = int_to_hex4(ypos) + + filename = "" + if sectortype == "old": + filename = path + "sectors/" + sector1 + "/" + yhex.lower() + else: + filename = path + "sectors2/" + sector2 + "/" + yhex.lower() + + f = file(filename, "rb") + + # Let's just memorize these even though it's not really necessary. + version = f.read(1) + flags = f.read(1) + + dec_o = zlib.decompressobj() + try: + mapdata = dec_o.decompress(f.read()) + except: + mapdata = [] + + f.close() + + if(len(mapdata)<4096): + print "bad: " + xhex+zhex+"/"+yhex + " " + len(mapdata) + else: + chunkxpos=xpos*16 + chunkypos=ypos*16 + chunkzpos=zpos*16 + for (x,z) in reversed(pixellist): + for y in reversed(range(16)): + datapos=x+y*16+z*256 + if(ord(mapdata[datapos])!=254): + try: + pixellist.remove((x,z)) + # Memorize information on the type and height of the block and for drawing the picture. + stuff[(chunkxpos+x,chunkzpos+z)]=(chunkypos+y,ord(mapdata[datapos])) + break + except: + print "strange block: " + xhex+zhex+"/"+yhex + " x: " + str(x) + " y: " + str(y) + " z: " + str(z) + " block: " + str(ord(mapdata[datapos])) + + # After finding all the pixeld in the sector, we can move on to the next sector without having to continue the Y axis. + if(len(pixellist)==0): + break + +print "Drawing image" +# Drawing the picture +starttime = time.time() +n = 0 +minx = min(xlist) +minz = min(zlist) +for (x,z) in stuff.iterkeys(): + if n % 500000 == 0: + nowtime = time.time() + dtime = nowtime - starttime + n_per_second = 1.0 * n / dtime + if n_per_second != 0: + listlen = len(stuff) + seconds_per_n = 1.0 / n_per_second + time_guess = seconds_per_n * listlen + remaining_s = time_guess - dtime + remaining_minutes = int(remaining_s / 60) + remaining_s -= remaining_minutes * 60; + print("Drawing pixel "+str(n)+" of "+str(listlen) + +" ("+str(round(100.0*n/listlen, 1))+"%)" + +" (ETA: "+str(remaining_minutes)+"m " + +str(int(remaining_s))+"s)") + n += 1 + + (r,g,b)=colors[stuff[(x,z)][1]] + + # Comparing heights of a couple of adjacent blocks and changing brightness accordingly. + try: + y1=stuff[(x-1,z)][0] + y2=stuff[(x,z-1)][0] + y=stuff[(x,z)][0] + + d=(y-y1+y-y2)*12 + + if(d>36): + d=36 + + r=limit(r+d,0,255) + g=limit(g+d,0,255) + b=limit(b+d,0,255) + except: + pass + #impix[w-1-(x-minx*16),h-1-(z-minz*16)]=(r,g,b) + impix[x-minx*16,h-1-(z-minz*16)]=(r,g,b) + +# Flip the picture to make it right and save. +#print "Transposing" +#im=im.transpose(Image.FLIP_TOP_BOTTOM) +print "Saving" +im.save(output) From cc65bda2cc727e813b06e2e819df39ce64ccf69b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:52:25 +0200 Subject: [PATCH 25/40] + sandstone color value now in minetestmapper --- minetestmapper/colors.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/minetestmapper/colors.txt b/minetestmapper/colors.txt index a7f8a36e4..a91a3c982 100644 --- a/minetestmapper/colors.txt +++ b/minetestmapper/colors.txt @@ -17,6 +17,7 @@ 19 199 199 199 20 183 183 222 21 103 78 42 +22 219 202 178 23 115 210 22 24 204 0 0 25 211 215 207 From 33264d0fb6b386f702191991815554c13ebdded9 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:54:05 +0200 Subject: [PATCH 26/40] * ignore minetestmapper output --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 64ebbef66..ee3aa43c9 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Makefile cmake_install.cmake src/jthread/libjthread.a debug.txt +minetestmapper/map.png From de8996ac3b2962aa6d3f613a6f99e77021540a45 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:13:00 +0200 Subject: [PATCH 27/40] * tabs to spaces --- minetestmapper/minetestmapper2.py | 370 +++++++++++++++--------------- 1 file changed, 185 insertions(+), 185 deletions(-) diff --git a/minetestmapper/minetestmapper2.py b/minetestmapper/minetestmapper2.py index f9b681bfb..6330cebbb 100755 --- a/minetestmapper/minetestmapper2.py +++ b/minetestmapper/minetestmapper2.py @@ -12,7 +12,7 @@ # Requires Python Imaging Library: http://www.pythonware.com/products/pil/ # Some speed-up: ...lol, actually it slows it down. -#import psyco ; psyco.full() +#import psyco ; psyco.full() #from psyco.classes import * import zlib @@ -22,36 +22,36 @@ import string import time def hex_to_int(h): - i = int(h,16) - if(i > 2047): - i-=4096 - return i + i = int(h,16) + if(i > 2047): + i-=4096 + return i def hex4_to_int(h): - i = int(h,16) - if(i > 32767): - i-=65536 - return i + i = int(h,16) + if(i > 32767): + i-=65536 + return i def int_to_hex3(i): - if(i < 0): - return "%03X" % (i + 4096) - else: - return "%03X" % i + if(i < 0): + return "%03X" % (i + 4096) + else: + return "%03X" % i def int_to_hex4(i): - if(i < 0): - return "%04X" % (i + 65536) - else: - return "%04X" % i + if(i < 0): + return "%04X" % (i + 65536) + else: + return "%04X" % i def limit(i,l,h): - if(i>h): - i=h - if(ih): + i=h + if(i sector_xmax: - continue - if z < sector_zmin or z > sector_zmax: - continue - xlist.append(x) - zlist.append(z) + for filename2 in os.listdir(path + "sectors2/" + filename): + x = hex_to_int(filename) + z = hex_to_int(filename2) + if x < sector_xmin or x > sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + xlist.append(x) + zlist.append(z) for filename in os.listdir(path + "sectors"): - x = hex4_to_int(filename[:4]) - z = hex4_to_int(filename[-4:]) - if x < sector_xmin or x > sector_xmax: - continue - if z < sector_zmin or z > sector_zmax: - continue - xlist.append(x) - zlist.append(z) + x = hex4_to_int(filename[:4]) + z = hex4_to_int(filename[-4:]) + if x < sector_xmin or x > sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + xlist.append(x) + zlist.append(z) w = (max(xlist) - min(xlist)) * 16 + 16 h = (max(zlist) - min(zlist)) * 16 + 16 @@ -107,118 +107,118 @@ starttime = time.time() # Go through all sectors. for n in range(len(xlist)): - #if n > 500: - # break - if n % 200 == 0: - nowtime = time.time() - dtime = nowtime - starttime - n_per_second = 1.0 * n / dtime - if n_per_second != 0: - seconds_per_n = 1.0 / n_per_second - time_guess = seconds_per_n * len(xlist) - remaining_s = time_guess - dtime - remaining_minutes = int(remaining_s / 60) - remaining_s -= remaining_minutes * 60; - print("Processing sector "+str(n)+" of "+str(len(xlist)) - +" ("+str(round(100.0*n/len(xlist), 1))+"%)" - +" (ETA: "+str(remaining_minutes)+"m " - +str(int(remaining_s))+"s)") + #if n > 500: + # break + if n % 200 == 0: + nowtime = time.time() + dtime = nowtime - starttime + n_per_second = 1.0 * n / dtime + if n_per_second != 0: + seconds_per_n = 1.0 / n_per_second + time_guess = seconds_per_n * len(xlist) + remaining_s = time_guess - dtime + remaining_minutes = int(remaining_s / 60) + remaining_s -= remaining_minutes * 60; + print("Processing sector "+str(n)+" of "+str(len(xlist)) + +" ("+str(round(100.0*n/len(xlist), 1))+"%)" + +" (ETA: "+str(remaining_minutes)+"m " + +str(int(remaining_s))+"s)") - xpos = xlist[n] - zpos = zlist[n] - - xhex = int_to_hex3(xpos) - zhex = int_to_hex3(zpos) - xhex4 = int_to_hex4(xpos) - zhex4 = int_to_hex4(zpos) - - sector1 = xhex4.lower() + zhex4.lower() - sector2 = xhex.lower() + "/" + zhex.lower() - - ylist=[] - - sectortype = "" - - try: - for filename in os.listdir(path + "sectors/" + sector1): - if(filename != "meta"): - pos = int(filename,16) - if(pos > 32767): - pos-=65536 - ylist.append(pos) - sectortype = "old" - except OSError: - pass - - if sectortype != "old": - try: - for filename in os.listdir(path + "sectors2/" + sector2): - if(filename != "meta"): - pos = int(filename,16) - if(pos > 32767): - pos-=65536 - ylist.append(pos) - sectortype = "new" - except OSError: - pass - - if sectortype == "": - continue + xpos = xlist[n] + zpos = zlist[n] - ylist.sort() - - # Make a list of pixels of the sector that are to be looked for. - pixellist = [] - for x in range(16): - for y in range(16): - pixellist.append((x,y)) - - # Go through the Y axis from top to bottom. - for ypos in reversed(ylist): - - yhex = int_to_hex4(ypos) + xhex = int_to_hex3(xpos) + zhex = int_to_hex3(zpos) + xhex4 = int_to_hex4(xpos) + zhex4 = int_to_hex4(zpos) - filename = "" - if sectortype == "old": - filename = path + "sectors/" + sector1 + "/" + yhex.lower() - else: - filename = path + "sectors2/" + sector2 + "/" + yhex.lower() + sector1 = xhex4.lower() + zhex4.lower() + sector2 = xhex.lower() + "/" + zhex.lower() - f = file(filename, "rb") + ylist=[] - # Let's just memorize these even though it's not really necessary. - version = f.read(1) - flags = f.read(1) + sectortype = "" - dec_o = zlib.decompressobj() - try: - mapdata = dec_o.decompress(f.read()) - except: - mapdata = [] - - f.close() - - if(len(mapdata)<4096): - print "bad: " + xhex+zhex+"/"+yhex + " " + len(mapdata) - else: - chunkxpos=xpos*16 - chunkypos=ypos*16 - chunkzpos=zpos*16 - for (x,z) in reversed(pixellist): - for y in reversed(range(16)): - datapos=x+y*16+z*256 - if(ord(mapdata[datapos])!=254): - try: - pixellist.remove((x,z)) - # Memorize information on the type and height of the block and for drawing the picture. - stuff[(chunkxpos+x,chunkzpos+z)]=(chunkypos+y,ord(mapdata[datapos])) - break - except: - print "strange block: " + xhex+zhex+"/"+yhex + " x: " + str(x) + " y: " + str(y) + " z: " + str(z) + " block: " + str(ord(mapdata[datapos])) - - # After finding all the pixeld in the sector, we can move on to the next sector without having to continue the Y axis. - if(len(pixellist)==0): - break + try: + for filename in os.listdir(path + "sectors/" + sector1): + if(filename != "meta"): + pos = int(filename,16) + if(pos > 32767): + pos-=65536 + ylist.append(pos) + sectortype = "old" + except OSError: + pass + + if sectortype != "old": + try: + for filename in os.listdir(path + "sectors2/" + sector2): + if(filename != "meta"): + pos = int(filename,16) + if(pos > 32767): + pos-=65536 + ylist.append(pos) + sectortype = "new" + except OSError: + pass + + if sectortype == "": + continue + + ylist.sort() + + # Make a list of pixels of the sector that are to be looked for. + pixellist = [] + for x in range(16): + for y in range(16): + pixellist.append((x,y)) + + # Go through the Y axis from top to bottom. + for ypos in reversed(ylist): + + yhex = int_to_hex4(ypos) + + filename = "" + if sectortype == "old": + filename = path + "sectors/" + sector1 + "/" + yhex.lower() + else: + filename = path + "sectors2/" + sector2 + "/" + yhex.lower() + + f = file(filename, "rb") + + # Let's just memorize these even though it's not really necessary. + version = f.read(1) + flags = f.read(1) + + dec_o = zlib.decompressobj() + try: + mapdata = dec_o.decompress(f.read()) + except: + mapdata = [] + + f.close() + + if(len(mapdata)<4096): + print "bad: " + xhex+zhex+"/"+yhex + " " + len(mapdata) + else: + chunkxpos=xpos*16 + chunkypos=ypos*16 + chunkzpos=zpos*16 + for (x,z) in reversed(pixellist): + for y in reversed(range(16)): + datapos=x+y*16+z*256 + if(ord(mapdata[datapos])!=254): + try: + pixellist.remove((x,z)) + # Memorize information on the type and height of the block and for drawing the picture. + stuff[(chunkxpos+x,chunkzpos+z)]=(chunkypos+y,ord(mapdata[datapos])) + break + except: + print "strange block: " + xhex+zhex+"/"+yhex + " x: " + str(x) + " y: " + str(y) + " z: " + str(z) + " block: " + str(ord(mapdata[datapos])) + + # After finding all the pixeld in the sector, we can move on to the next sector without having to continue the Y axis. + if(len(pixellist)==0): + break print "Drawing image" # Drawing the picture @@ -227,46 +227,46 @@ n = 0 minx = min(xlist) minz = min(zlist) for (x,z) in stuff.iterkeys(): - if n % 500000 == 0: - nowtime = time.time() - dtime = nowtime - starttime - n_per_second = 1.0 * n / dtime - if n_per_second != 0: - listlen = len(stuff) - seconds_per_n = 1.0 / n_per_second - time_guess = seconds_per_n * listlen - remaining_s = time_guess - dtime - remaining_minutes = int(remaining_s / 60) - remaining_s -= remaining_minutes * 60; - print("Drawing pixel "+str(n)+" of "+str(listlen) - +" ("+str(round(100.0*n/listlen, 1))+"%)" - +" (ETA: "+str(remaining_minutes)+"m " - +str(int(remaining_s))+"s)") - n += 1 + if n % 500000 == 0: + nowtime = time.time() + dtime = nowtime - starttime + n_per_second = 1.0 * n / dtime + if n_per_second != 0: + listlen = len(stuff) + seconds_per_n = 1.0 / n_per_second + time_guess = seconds_per_n * listlen + remaining_s = time_guess - dtime + remaining_minutes = int(remaining_s / 60) + remaining_s -= remaining_minutes * 60; + print("Drawing pixel "+str(n)+" of "+str(listlen) + +" ("+str(round(100.0*n/listlen, 1))+"%)" + +" (ETA: "+str(remaining_minutes)+"m " + +str(int(remaining_s))+"s)") + n += 1 - (r,g,b)=colors[stuff[(x,z)][1]] - - # Comparing heights of a couple of adjacent blocks and changing brightness accordingly. - try: - y1=stuff[(x-1,z)][0] - y2=stuff[(x,z-1)][0] - y=stuff[(x,z)][0] - - d=(y-y1+y-y2)*12 - - if(d>36): - d=36 - - r=limit(r+d,0,255) - g=limit(g+d,0,255) - b=limit(b+d,0,255) - except: - pass - #impix[w-1-(x-minx*16),h-1-(z-minz*16)]=(r,g,b) - impix[x-minx*16,h-1-(z-minz*16)]=(r,g,b) + (r,g,b)=colors[stuff[(x,z)][1]] + + # Comparing heights of a couple of adjacent blocks and changing brightness accordingly. + try: + y1=stuff[(x-1,z)][0] + y2=stuff[(x,z-1)][0] + y=stuff[(x,z)][0] + + d=(y-y1+y-y2)*12 + + if(d>36): + d=36 + + r=limit(r+d,0,255) + g=limit(g+d,0,255) + b=limit(b+d,0,255) + except: + pass + #impix[w-1-(x-minx*16),h-1-(z-minz*16)]=(r,g,b) + impix[x-minx*16,h-1-(z-minz*16)]=(r,g,b) # Flip the picture to make it right and save. #print "Transposing" -#im=im.transpose(Image.FLIP_TOP_BOTTOM) +#im=im.transpose(Image.FLIP_TOP_BOTTOM) print "Saving" im.save(output) From 34e57da1ca55ee13fb3df1f06b8fad61f7cac016 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:19:50 +0200 Subject: [PATCH 28/40] * encoding fix --- minetestmapper/minetestmapper2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minetestmapper/minetestmapper2.py b/minetestmapper/minetestmapper2.py index 6330cebbb..b7264fe34 100755 --- a/minetestmapper/minetestmapper2.py +++ b/minetestmapper/minetestmapper2.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: windows-1252 -*- +# -*- coding: utf-8 -*- # Made by j0gge, modified by celeron55 From bd5cdbf1a44c8ce969867e1b24d9ec6918c14a0c Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:21:58 +0200 Subject: [PATCH 29/40] + check if sectors/sectors2 directories exist before attempting to read them --- minetestmapper/minetestmapper2.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/minetestmapper/minetestmapper2.py b/minetestmapper/minetestmapper2.py index b7264fe34..8dc3de2f4 100755 --- a/minetestmapper/minetestmapper2.py +++ b/minetestmapper/minetestmapper2.py @@ -73,25 +73,28 @@ xlist = [] zlist = [] # List all sectors to memory and calculate the width and heigth of the resulting picture. -for filename in os.listdir(path + "sectors2"): - for filename2 in os.listdir(path + "sectors2/" + filename): - x = hex_to_int(filename) - z = hex_to_int(filename2) +if os.path.exists(path + "sectors2"): + for filename in os.listdir(path + "sectors2"): + for filename2 in os.listdir(path + "sectors2/" + filename): + x = hex_to_int(filename) + z = hex_to_int(filename2) + if x < sector_xmin or x > sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + xlist.append(x) + zlist.append(z) + +if os.path.exists(path + "sectors"): + for filename in os.listdir(path + "sectors"): + x = hex4_to_int(filename[:4]) + z = hex4_to_int(filename[-4:]) if x < sector_xmin or x > sector_xmax: continue if z < sector_zmin or z > sector_zmax: continue xlist.append(x) zlist.append(z) -for filename in os.listdir(path + "sectors"): - x = hex4_to_int(filename[:4]) - z = hex4_to_int(filename[-4:]) - if x < sector_xmin or x > sector_xmax: - continue - if z < sector_zmin or z > sector_zmax: - continue - xlist.append(x) - zlist.append(z) w = (max(xlist) - min(xlist)) * 16 + 16 h = (max(zlist) - min(zlist)) * 16 + 16 From e627f023a09bcb9db2ace81832c2c326ef38d0ec Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:52:36 +0200 Subject: [PATCH 30/40] * made cactus color darker --- minetestmapper/colors.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minetestmapper/colors.txt b/minetestmapper/colors.txt index a91a3c982..144d79830 100644 --- a/minetestmapper/colors.txt +++ b/minetestmapper/colors.txt @@ -18,6 +18,6 @@ 20 183 183 222 21 103 78 42 22 219 202 178 -23 115 210 22 +23 78 154 6 24 204 0 0 25 211 215 207 From 3bb1cfdf360c50aa317b029c2886de80dc4d573d Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:55:28 +0200 Subject: [PATCH 31/40] + papyrus --- data/papyrus.png | Bin 0 -> 366 bytes src/map.cpp | 27 +++++++++++++++++++-- src/mapblock.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++ src/mapnode.cpp | 10 ++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 1 + src/tile.cpp | 1 + 8 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 data/papyrus.png diff --git a/data/papyrus.png b/data/papyrus.png new file mode 100644 index 0000000000000000000000000000000000000000..bf0dec7fe2f2048a4f521c8efce41fd775ef1339 GIT binary patch literal 366 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfZ8j!h8TlvGX3u~^k|nMYCC>S|xv6<249-QVi6yBi3gww4 z84B*6z5(HleBwYww>@1PLo7}w$NbQk_)zum)BpPRHc2lo)}Gw)qEN_h-;M^E`sQ-fP#!OO#8CHBS# z{=^hT{;@x~ae?}Svkg=9BsirSbe}%_Y<%@FFaUlvmanip, v2s16(x,z)); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Don't make a tree so high that it doesn't fit if(y > y_nodes_max - 6) @@ -3236,6 +3250,15 @@ void makeChunk(ChunkMakeData *data) MapNode *n = &data->vmanip.m_data[i]; if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS && n->d != CONTENT_SAND) continue; + // Papyrus grows only on mud and in water + if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + { + p.Y++; + make_papyrus(data->vmanip, p); + } + // Don't make a tree under water level + if(y < WATER_LEVEL) + continue; // Trees grow only on mud and grass if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) { @@ -3243,7 +3266,7 @@ void makeChunk(ChunkMakeData *data) make_tree(data->vmanip, p); } // Cactii grow only on sand - if(n->d == CONTENT_SAND) + else if(n->d == CONTENT_SAND) { p.Y++; make_cactus(data->vmanip, p); diff --git a/src/mapblock.cpp b/src/mapblock.cpp index d98bfaf1e..c6b82634d 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -987,6 +987,16 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) g_texturesource->getTextureId("wood.png")); material_wood.setTexture(0, pa_wood.atlas); + // Papyrus material + video::SMaterial material_papyrus; + material_papyrus.setFlag(video::EMF_LIGHTING, false); + material_papyrus.setFlag(video::EMF_BILINEAR_FILTER, false); + material_papyrus.setFlag(video::EMF_FOG_ENABLE, true); + material_papyrus.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + AtlasPointer pa_papyrus = g_texturesource->getTexture( + g_texturesource->getTextureId("papyrus.png")); + material_papyrus.setTexture(0, pa_papyrus.atlas); + for(s16 z=0; zm_daynight_ratio))); + video::SColor c(255,l,l,l); + for(u32 j=0; j<4; j++) + { + video::S3DVertex vertices[4] = + { + video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y1()), + video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y1()), + video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y0()), + video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y0()), + }; + if(j == 0) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(45); + } + else if(j == 1) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-45); + } + else if(j == 2) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(135); + } + else if(j == 3) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-135); + } + + for(u16 i=0; i<4; i++) + { + vertices[i].Pos += intToFloat(p + blockpos_nodes, BS); + } + + u16 indices[] = {0,1,2,2,3,0}; + // Add to mesh collector + collector.append(material_papyrus, vertices, 4, indices, 6); + } + } } diff --git a/src/mapnode.cpp b/src/mapnode.cpp index cef9bbf03..954c85f2f 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -241,6 +241,16 @@ void init_mapnode() f->is_ground_content = true; f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_PAPYRUS; + f = &g_content_features[i]; + f->setInventoryTexture("papyrus.png"); + f->light_propagates = true; + f->param_type = CPT_LIGHT; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + f->solidness = 0; // drawn separately, makes no faces + f->walkable = false; + i = CONTENT_GLASS; f = &g_content_features[i]; f->light_propagates = true; diff --git a/src/mapnode.h b/src/mapnode.h index e8cc0ab51..52d0199c4 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -105,6 +105,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_CACTUS 23 #define CONTENT_BRICK 24 #define CONTENT_CLAY 25 +#define CONTENT_PAPYRUS 26 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 8c23056f2..e95ca7ba9 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -76,6 +76,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_TREE, 1.0); setWoodLikeDiggingProperties(CONTENT_LEAVES, 0.15); setWoodLikeDiggingProperties(CONTENT_CACTUS, 0.75); + setWoodLikeDiggingProperties(CONTENT_PAPYRUS, 0.25); setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); diff --git a/src/server.cpp b/src/server.cpp index 17850c5fa..e9875456c 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4111,6 +4111,7 @@ void setCreativeInventory(Player *player) CONTENT_TREE, CONTENT_LEAVES, CONTENT_CACTUS, + CONTENT_PAPYRUS, CONTENT_GLASS, CONTENT_FENCE, CONTENT_MESE, diff --git a/src/tile.cpp b/src/tile.cpp index 71e0c9638..c77262c49 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -517,6 +517,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("leaves.png"); sourcelist.push_back("cactus_side.png"); sourcelist.push_back("cactus_top.png"); + sourcelist.push_back("papyrus.png"); sourcelist.push_back("glass.png"); sourcelist.push_back("mud.png^grass_side.png"); sourcelist.push_back("cobble.png"); From 8da4a4276ff1b8da0aa087548b4bf032098196d1 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:56:27 +0200 Subject: [PATCH 32/40] + papyrus in minetestmapper --- minetestmapper/colors.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/minetestmapper/colors.txt b/minetestmapper/colors.txt index 144d79830..7c2d3f972 100644 --- a/minetestmapper/colors.txt +++ b/minetestmapper/colors.txt @@ -21,3 +21,4 @@ 23 78 154 6 24 204 0 0 25 211 215 207 +26 138 226 52 From 17e17ceb599588295d9f8eb7edf46fb39972d78c Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:57:39 +0200 Subject: [PATCH 33/40] * README updated --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 4610ed141..c2738894c 100644 --- a/README +++ b/README @@ -8,6 +8,7 @@ New bricks: * Cactus (plant that grows on sand) * Clay (found in sand at sea level, yields 4 lumps of clay) * Brick (made from 4 clay bricks, yields 4 clay bricks) +* Papyrus (plant that grows in shallow water) New materials: * Lump of clay From 1bd25925cb8b4f96f5d5deec348db1214f3da525 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:12:56 +0200 Subject: [PATCH 34/40] + paper, book, bookshelf --- data/book.png | Bin 0 -> 292 bytes data/bookshelf.png | Bin 0 -> 597 bytes data/paper.png | Bin 0 -> 242 bytes src/inventory.cpp | 4 ++++ src/mapnode.cpp | 11 ++++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++ src/tile.cpp | 1 + 9 files changed, 67 insertions(+) create mode 100644 data/book.png create mode 100644 data/bookshelf.png create mode 100644 data/paper.png diff --git a/data/book.png b/data/book.png new file mode 100644 index 0000000000000000000000000000000000000000..176fb6aa96154614c7edb3a7ed80064d23a8fceb GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRt!3HF+tk*dLq!^2X+?^QKos)S9vL>4nJ za0`PlBg3pY5H=O_SORIEGl9PEL@>IN;&oSg&%qUSfB_ zPkXmTybjkocrNfJsx0|IqP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RW1_J>KEte|7$^ZZX=Sf6CR4C7- zQq61Aa2S5_%bTRBSzR$8Oxw#ktsn{=dYK1hc-f@`Jq&vAQkVp9$~^3%;1IkCK_-Yy z{{TTz4}P#BC?RO4;$ea^u~tzlOJ`!+^q0g#Yn>f};B$I;-mi!Ed4+S+qr`|ezq=uE zCIeB!t4CqT;435|qQrnEO9WChO(jVoZF6#=fNO8|;SYp>R~QS};^K4D zuuQ`OaCL{}==omBDckDBj-Ge){Ib17nVs8zq^<)<7bo%P_rP?qoV5Yq@X+}Ej}MO@ z3<1!)ENj(k@ybNJGSMr|4JUHLU4@;^reV#O*nElkjWyfN>6xcC zfESbFqpE$eJ~vpqdFh0W2Y51g7Qg{OO{VGYt;e&MPj(uvL>4nJ za0`PlBg3pY5H=O_SKve#96}gV#iqlw;solidness = 0; // drawn separately, makes no faces f->walkable = false; + i = CONTENT_BOOKSHELF; + f = &g_content_features[i]; + f->setAllTextures("bookshelf.png"); + f->setTexture(0, "wood.png"); + f->setTexture(1, "wood.png"); + // FIXME: setInventoryTextureCube() only cares for the first texture + f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png"); + //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png"); + f->param_type = CPT_MINERAL; + f->is_ground_content = true; + i = CONTENT_GLASS; f = &g_content_features[i]; f->light_propagates = true; diff --git a/src/mapnode.h b/src/mapnode.h index 52d0199c4..57335b741 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -106,6 +106,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_BRICK 24 #define CONTENT_CLAY 25 #define CONTENT_PAPYRUS 26 +#define CONTENT_BOOKSHELF 27 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index e95ca7ba9..7815f593e 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -80,6 +80,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); + setWoodLikeDiggingProperties(CONTENT_BOOKSHELF, 0.75); setWoodLikeDiggingProperties(CONTENT_CHEST, 1.0); g_material_properties[CONTENT_SIGN_WALL].setDiggingProperties("", diff --git a/src/server.cpp b/src/server.cpp index e9875456c..f40ed05a5 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4017,6 +4017,54 @@ void Server::UpdateCrafting(u16 peer_id) found = true; } } + + // Paper + if(!found) + { + ItemSpec specs[9]; + specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + specs[4] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + specs[5] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new CraftItem("paper", 1)); + found = true; + } + } + + // Book + if(!found) + { + ItemSpec specs[9]; + specs[1] = ItemSpec(ITEM_CRAFT, "paper"); + specs[4] = ItemSpec(ITEM_CRAFT, "paper"); + specs[7] = ItemSpec(ITEM_CRAFT, "paper"); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new CraftItem("book", 1)); + found = true; + } + } + + // Book shelf + if(!found) + { + ItemSpec specs[9]; + specs[0] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[1] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[2] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[3] = ItemSpec(ITEM_CRAFT, "book"); + specs[4] = ItemSpec(ITEM_CRAFT, "book"); + specs[5] = ItemSpec(ITEM_CRAFT, "book"); + specs[6] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[7] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[8] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_BOOKSHELF, 1)); + found = true; + } + } } } // if creative_mode == false @@ -4112,6 +4160,7 @@ void setCreativeInventory(Player *player) CONTENT_LEAVES, CONTENT_CACTUS, CONTENT_PAPYRUS, + CONTENT_BOOKSHELF, CONTENT_GLASS, CONTENT_FENCE, CONTENT_MESE, diff --git a/src/tile.cpp b/src/tile.cpp index c77262c49..c703e147c 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -518,6 +518,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("cactus_side.png"); sourcelist.push_back("cactus_top.png"); sourcelist.push_back("papyrus.png"); + sourcelist.push_back("bookshelf.png"); sourcelist.push_back("glass.png"); sourcelist.push_back("mud.png^grass_side.png"); sourcelist.push_back("cobble.png"); From c3cd89705d4f9ce92c934f824caedb2f679cb780 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:13:31 +0200 Subject: [PATCH 35/40] * point out setInventoryTextureCube() is broken with a FIXME --- src/tile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tile.cpp b/src/tile.cpp index c703e147c..77084bf10 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -1092,7 +1092,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg, imagename_right, device); assert(img_top && img_left && img_right); - // TODO: Create textures from images + // FIXME: Create textures from left and right images video::ITexture *texture_top = driver->addTexture( (imagename_top + "__temp__").c_str(), img_top); assert(texture_top); From 15ae9ca8a2def7271ac8bd2f262ce14df4f3589d Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:31:42 +0200 Subject: [PATCH 36/40] + bookshelf in minetestmapper, same color as wood --- minetestmapper/colors.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/minetestmapper/colors.txt b/minetestmapper/colors.txt index 7c2d3f972..e70f56e1e 100644 --- a/minetestmapper/colors.txt +++ b/minetestmapper/colors.txt @@ -22,3 +22,4 @@ 24 204 0 0 25 211 215 207 26 138 226 52 +27 104 78 42 From b3c439fb16bb5a5566702f8d9d1cfcd2f9e20e18 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:39:07 +0200 Subject: [PATCH 37/40] * README updated --- README | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README b/README index c2738894c..3230fd917 100644 --- a/README +++ b/README @@ -8,11 +8,14 @@ New bricks: * Cactus (plant that grows on sand) * Clay (found in sand at sea level, yields 4 lumps of clay) * Brick (made from 4 clay bricks, yields 4 clay bricks) -* Papyrus (plant that grows in shallow water) +* Papyrus (plant that grows in shallow water, yields paper) +* Book shelf (made from 6 wood and 3 books, sandwhiched) New materials: * Lump of clay * Clay brick (made from lumps of clay in the furnace) +* Paper +* Book (made from 3 paper) Alternate graphics: * Player From 51d308c666dfd023169b7d5e200fbefb3d315d3b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 7 Jun 2011 19:24:30 +0200 Subject: [PATCH 38/40] + rail --- data/rail.png | Bin 0 -> 507 bytes data/rail_crossing.png | Bin 0 -> 555 bytes data/rail_curved.png | Bin 0 -> 545 bytes data/rail_t_junction.png | Bin 0 -> 542 bytes src/mapblock.cpp | 104 +++++++++++++++++++++++++++++++++++++++ src/mapnode.cpp | 11 +++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 21 ++++++++ 9 files changed, 138 insertions(+) create mode 100644 data/rail.png create mode 100644 data/rail_crossing.png create mode 100644 data/rail_curved.png create mode 100644 data/rail_t_junction.png diff --git a/data/rail.png b/data/rail.png new file mode 100644 index 0000000000000000000000000000000000000000..18176d9f3ca96ec9d6e4f6d41ab7a370aa93afeb GIT binary patch literal 507 zcmVPx#32;bRa{vGf6951U69E94oEQKA0ia1lK~y-)&6B@N98na7zxU=j>tw-1NU+dC z$R7|iDkRvYlN13FYq7KtBq?H-#uQ1DLLq{r2&pX$1_VLKkH%H8P!L5{QJk!+E9*{n zX7{~$DP}X0Dv+e`l=mJ!?mgTK4J|D%+M(e=%O5l}JZP7e7gL`C`1G$_s@G%;@gRCt94BK9S=tc{8B`VrwD5XzZ8-yC%%tU5AEa0 zZ%GDwheg^NfZc;4K{aOo$Uz8D5~8}Lreho_z)O6&E&n=Y@L{qqCC-d@S?->n;GR+yChoegbuB)%daag-!qf002ovPDHLkV1f&}+gAVp literal 0 HcmV?d00001 diff --git a/data/rail_crossing.png b/data/rail_crossing.png new file mode 100644 index 0000000000000000000000000000000000000000..98464057704a84ab9dfeac63f13e9b1af8d6f1ae GIT binary patch literal 555 zcmV+`0@VG9P)Px#32;bRa{vGf6951U69E94oEQKA0nkZAK~y-)rIO1_TTu{)f0KKoRRR_lqV;bm zr9MLUuEdQf>aH763q==-RD)0`2t`A5A%f3E>!UtMqfi%uOLtnqN=hSIF*o-pii$|c z>ty({&l`wmn9nC&tD zH{AA?^Bi{ARl;OvDH8~}ISS4$W0-b1*|(SCzIB!H`>z{h1AxD~y6j~C@EDu^AQFir zb^-#M{vfve8te*TV<#xNKLOpG!k0OXZZF(EopQ4kgia&yEa^1#>zHD30}NnbSxBzm zt5e1?UWF6L&&!s%F#la8LLGMC{;szre zHPGi3)H|ab;?J8O#A-SS!%Zm%xl t#n10DZ{q#v_X+}p%soCq9-m0t(KTmX;6MA&eM$fT002ovPDHLkV1jh{_{snP literal 0 HcmV?d00001 diff --git a/data/rail_curved.png b/data/rail_curved.png new file mode 100644 index 0000000000000000000000000000000000000000..62afa3d2b81c4dc6f85275ea6de89ffb43a1be8b GIT binary patch literal 545 zcmV++0^a?JP)Px#32;bRa{vGf6951U69E94oEQKA0mey0K~y-)y^~K!lW`cwKfi6gPR1Y?nzVF- zL=q2^R^-8Bdg>w+Aq8Qg{Si8hC?ObxLVpgHC@34dc#&995Eu+Rb&64R=o+CI6;86b zcguHwo(|)kdubEB^xS?Ae811<`SXMS84s_Wl*N0er8?(0h{2Cdo#5qZ5(89B)PBW@ zm1O~lMq-w{I;gPCNaFW;xIOnt)otPaP=|E+nrP{NP!YzTzf=I@=Z}lWt?fMn!!Rmh zQ)q_AeTYH_F*VOk^mUQM1u{%N8#a0vw^6wU^t5@eIF8V}k&^XrY=El>H z3LrGtF5cF|WrFaPPMI3+mU<+Q;;Tx}8tB;^ixX!Az$geVr=v`8_kvH(-JB;HiE*jx z8+xutNlFYq`CuUl4YteCBQ6@98t*nbtSy-MZAKE8)6TCMdY=pOS*XikO-TO1mzFFTjQ;6NB jK=T98eWHb{kCW;zgEX_2=&9K_00000NkvXXu0mjfyq^6z literal 0 HcmV?d00001 diff --git a/data/rail_t_junction.png b/data/rail_t_junction.png new file mode 100644 index 0000000000000000000000000000000000000000..9985f63cd49ce29f636e72fe3b168fe1b6bad236 GIT binary patch literal 542 zcmV+(0^$9MP)Px#32;bRa{vGf6951U69E94oEQKA0mDf|K~y-)m6J_KRB;r=fB$)ZUZZ_L8#mDh z6@df|6=4fE5w?gnGRPpb3DLkd89|F;KxiSMsTeWLFzblP3<84zTeORaAX>G1evpBZ zito*PZ+!2znCAKQ)V#}c?>U@vxflLbd1_KRGHGFt>d2&}JT)23X@FNxS|T8K|Du>W zf$aq-AQaGsqPiAh>I5I>YjeZB7o_jycclS7eVe2GTCMTZTI6t}W^vi)P=lu81vDlN zTtCF|0yuISfb;1A%4tMxj8MoIDZL(7an|d$3;E(ETJI_k< z$)hy2^+&|Iv#pDc74UsOBJUKbUWquctv5#@UnJG=gE!f$vM+&+%UoEhVEtZZ^j=E# z<)B_8@21tS1&5VYm*T_A@?Qd5a}SPN%643=`4w_~mn2pod;8q3IR{FXvK=4Wsch?M z0N3>*Ak#d@tw&cRl#n~mzD7=l-dgHG`w78Z{|SI?mw4R&!oj4$pVca@sbf^UfaC## z&ZnO@-9dLxSNt73pO}tB6-YGzQ!7f@7Fn{_D9_f&A70#Lcw$EFddg$(XV=9PVk8up gr)tl1rU{tgFLW2g;W?8CasU7T07*qoM6N<$g8pIiBme*a literal 0 HcmV?d00001 diff --git a/src/mapblock.cpp b/src/mapblock.cpp index c6b82634d..71044652d 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1672,6 +1672,110 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) collector.append(material_papyrus, vertices, 4, indices, 6); } } + else if(n.d == CONTENT_RAIL) + { + u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio)); + video::SColor c(255,l,l,l); + + bool is_rail_x [] = { false, false }; /* x-1, x+1 */ + bool is_rail_z [] = { false, false }; /* z-1, z+1 */ + + MapNode n_minus_x = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x-1,y,z)); + MapNode n_plus_x = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x+1,y,z)); + MapNode n_minus_z = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y,z-1)); + MapNode n_plus_z = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y,z+1)); + + if(n_minus_x.d == CONTENT_RAIL) + is_rail_x[0] = true; + if(n_plus_x.d == CONTENT_RAIL) + is_rail_x[1] = true; + if(n_minus_z.d == CONTENT_RAIL) + is_rail_z[0] = true; + if(n_plus_z.d == CONTENT_RAIL) + is_rail_z[1] = true; + + float d = (float)BS/16; + video::S3DVertex vertices[4] = + { + video::S3DVertex(-BS/2,-BS/2+d,-BS/2, 0,0,0, c, + 0, 1), + video::S3DVertex(BS/2,-BS/2+d,-BS/2, 0,0,0, c, + 1, 1), + video::S3DVertex(BS/2,-BS/2+d,BS/2, 0,0,0, c, + 1, 0), + video::S3DVertex(-BS/2,-BS/2+d,BS/2, 0,0,0, c, + 0, 0), + }; + + video::SMaterial material_rail; + material_rail.setFlag(video::EMF_LIGHTING, false); + material_rail.setFlag(video::EMF_BACK_FACE_CULLING, false); + material_rail.setFlag(video::EMF_BILINEAR_FILTER, false); + material_rail.setFlag(video::EMF_FOG_ENABLE, true); + material_rail.MaterialType + = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + + int adjacencies = is_rail_x[0] + is_rail_x[1] + is_rail_z[0] + is_rail_z[1]; + + // Assign textures + if(adjacencies < 2) + material_rail.setTexture(0, g_texturesource->getTextureRaw("rail.png")); + else if(adjacencies == 2) + { + if((is_rail_x[0] && is_rail_x[1]) || (is_rail_z[0] && is_rail_z[1])) + material_rail.setTexture(0, g_texturesource->getTextureRaw("rail.png")); + else + material_rail.setTexture(0, g_texturesource->getTextureRaw("rail_curved.png")); + } + else if(adjacencies == 3) + material_rail.setTexture(0, g_texturesource->getTextureRaw("rail_t_junction.png")); + else if(adjacencies == 4) + material_rail.setTexture(0, g_texturesource->getTextureRaw("rail_crossing.png")); + + // Rotate textures + int angle = 0; + + if(adjacencies == 1) + { + if(is_rail_x[0] || is_rail_x[1]) + angle = 90; + } + else if(adjacencies == 2) + { + if(is_rail_x[0] && is_rail_x[1]) + angle = 90; + else if(is_rail_x[0] && is_rail_z[0]) + angle = 270; + else if(is_rail_x[0] && is_rail_z[1]) + angle = 180; + else if(is_rail_x[1] && is_rail_z[1]) + angle = 90; + } + else if(adjacencies == 3) + { + if(!is_rail_x[0]) + angle=0; + if(!is_rail_x[1]) + angle=180; + if(!is_rail_z[0]) + angle=90; + if(!is_rail_z[1]) + angle=270; + } + + if(angle != 0) { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(angle); + } + + for(s32 i=0; i<4; i++) + { + vertices[i].Pos += intToFloat(p + blockpos_nodes, BS); + } + + u16 indices[] = {0,1,2,2,3,0}; + collector.append(material_rail, vertices, 4, indices, 6); + } } diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 7e97a8d04..1c0a2740b 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -281,6 +281,17 @@ void init_mapnode() f->solidness = 0; // drawn separately, makes no faces f->air_equivalent = true; // grass grows underneath + i = CONTENT_RAIL; + f = &g_content_features[i]; + f->setInventoryTexture("rail.png"); + f->light_propagates = true; + f->param_type = CPT_LIGHT; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + f->solidness = 0; // drawn separately, makes no faces + f->air_equivalent = true; // grass grows underneath + f->walkable = false; + // Deprecated i = CONTENT_COALSTONE; f = &g_content_features[i]; diff --git a/src/mapnode.h b/src/mapnode.h index 57335b741..409fe2bcf 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -107,6 +107,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_CLAY 25 #define CONTENT_PAPYRUS 26 #define CONTENT_BOOKSHELF 27 +#define CONTENT_RAIL 28 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 7815f593e..a8a9a94a8 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -79,6 +79,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_PAPYRUS, 0.25); setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); + setDirtLikeDiggingProperties(CONTENT_RAIL, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); setWoodLikeDiggingProperties(CONTENT_BOOKSHELF, 0.75); setWoodLikeDiggingProperties(CONTENT_CHEST, 1.0); diff --git a/src/server.cpp b/src/server.cpp index f40ed05a5..4e9ff076f 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3915,6 +3915,26 @@ void Server::UpdateCrafting(u16 peer_id) } } + // Rail + if(!found) + { + ItemSpec specs[9]; + specs[0] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + specs[1] = ItemSpec(ITEM_CRAFT, "Stick"); + specs[2] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + specs[3] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + specs[4] = ItemSpec(ITEM_CRAFT, "Stick"); + specs[5] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + specs[6] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + specs[7] = ItemSpec(ITEM_CRAFT, "Stick"); + specs[8] = ItemSpec(ITEM_CRAFT, "steel_ingot"); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_RAIL, 15)); + found = true; + } + } + // Chest if(!found) { @@ -4163,6 +4183,7 @@ void setCreativeInventory(Player *player) CONTENT_BOOKSHELF, CONTENT_GLASS, CONTENT_FENCE, + CONTENT_RAIL, CONTENT_MESE, CONTENT_WATERSOURCE, CONTENT_CLOUD, From 2ec160454a013dfc84b109c5c0b0901ac1055559 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 7 Jun 2011 19:41:03 +0200 Subject: [PATCH 39/40] * README updated --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 3230fd917..9b1f54e95 100644 --- a/README +++ b/README @@ -10,6 +10,7 @@ New bricks: * Brick (made from 4 clay bricks, yields 4 clay bricks) * Papyrus (plant that grows in shallow water, yields paper) * Book shelf (made from 6 wood and 3 books, sandwhiched) +* Rail (made from 6 iron ingots and 3 sticks, vertically sandwhiched) New materials: * Lump of clay From e261cc9e8fa67c9020fa0a82bd1a7041ecd351a0 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 8 Jun 2011 05:27:51 +0200 Subject: [PATCH 40/40] + rail block bounding box --- src/game.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/game.cpp b/src/game.cpp index 7970a6ed9..bbd0a22ef 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -530,6 +530,43 @@ void getPointedNode(Client *client, v3f player_position, } } } + else if(n.d == CONTENT_RAIL) + { + v3s16 dir = unpackDir(n.dir); + v3f dir_f = v3f(dir.X, dir.Y, dir.Z); + dir_f *= BS/2 - BS/6 - BS/20; + v3f cpf = npf + dir_f; + f32 distance = (cpf - camera_position).getLength(); + + float d = (float)BS/16; + v3f vertices[4] = + { + v3f(BS/2, -BS/2+d, -BS/2), + v3f(-BS/2, -BS/2, BS/2), + }; + + for(s32 i=0; i<2; i++) + { + vertices[i] += npf; + } + + core::aabbox3d box; + + box = core::aabbox3d(vertices[0]); + box.addInternalPoint(vertices[1]); + + if(distance < mindistance) + { + if(box.intersectsWithLine(shootline)) + { + nodefound = true; + nodepos = np; + neighbourpos = np; + mindistance = distance; + nodehilightbox = box; + } + } + } /* Regular blocks */