From e76f4155d52e7f79fd40e4f9ac0b9321c1ab9706 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 28 May 2011 02:17:19 +0200 Subject: [PATCH 001/107] + sandstone --- .hgtags | 5 ----- 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 + 7 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 data/sandstone.png diff --git a/.hgtags b/.hgtags index f59575790..95bda33a8 100644 --- a/.hgtags +++ b/.hgtags @@ -1,6 +1 @@ c37bcfd89dd627fdb131ae3f77fcaab02721bf76 working -69547bd6be420eb40f55524fd2131cbbaa2e0e29 110107195706-exp -e3c3c8e27bbc8c9b61710517a78944deb1c61696 110211211322 -23880c78e40c50ad54fcd8844510f7a423b37f2a 110212200513 -20c49c98c92a62df457b773c562df41d4167492b 110214175330 -10be2b71f965585af90af96903e83b4ddff52bf9 20110424_0 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 c39a03d8032368fcb720ee6b8001878bdb2981c7 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 18:45:50 +0200 Subject: [PATCH 002/107] * 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 50021073bf23ce5f796624cea34a66c5d1357ce4 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 18:47:40 +0200 Subject: [PATCH 003/107] * 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 004/107] * 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 005/107] * 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 006/107] * 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 007/107] + 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 5f063ce97c462710a003c255b52c76a5ed74acc2 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 29 May 2011 19:08:59 +0200 Subject: [PATCH 008/107] + .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 544aeb08404f8bb6848f64140909715afbf7d1f1 Mon Sep 17 00:00:00 2001 From: teddydestodes Date: Sun, 29 May 2011 19:17:42 +0200 Subject: [PATCH 009/107] 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 876553220fba89092864f43bafac44f91e71c743 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 30 May 2011 01:08:59 +0800 Subject: [PATCH 010/107] + .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 289e31ed981371fa05bd02488e38e2d0f0f5effe Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 30 May 2011 14:42:08 +0200 Subject: [PATCH 011/107] + 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 b461213ddbdb838f76f22ece59d1c64d1485b8ee Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 02:56:23 +0200 Subject: [PATCH 012/107] * 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 6ca51de990f7b58001e1da93d949023cee697173 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 02:56:41 +0200 Subject: [PATCH 013/107] + 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 8d580ddf29ef4c42ddbe36f48cf7fd5f06ad400b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 20:52:20 +0200 Subject: [PATCH 014/107] * 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 015/107] + 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 ba1460a5822d38dc6617717fa5fec9b033bb0a29 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 04:57:46 +0200 Subject: [PATCH 016/107] + 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 5f52a622b6a2602742ea472c1163eba2acf17fb6 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 08:09:28 +0200 Subject: [PATCH 017/107] * 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 9de57d13bc7a97fba17da5807e1ef57d96586deb Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 31 May 2011 08:56:23 +0800 Subject: [PATCH 018/107] * 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 2f2f28d3985a226a6babe87f1cdc506e1c0604bc Mon Sep 17 00:00:00 2001 From: MrLoom Date: Wed, 1 Jun 2011 14:13:22 +0200 Subject: [PATCH 019/107] 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 0bcc83a7728b45e02c62ba2beb50a9892a05ab59 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 16:46:49 +0200 Subject: [PATCH 020/107] * 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 96d709dac1c609911c343c9cd586848ba4d02a18 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 17:19:28 +0200 Subject: [PATCH 021/107] * 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 6434f64ab41c344ba7474305a9e6a6ad7a36a7a5 Mon Sep 17 00:00:00 2001 From: teddydestodes Date: Wed, 1 Jun 2011 19:44:07 +0200 Subject: [PATCH 022/107] 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 2b5a775bce80093d5a0ba5dd7b0ae85728ef22ca Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 03:03:47 +0200 Subject: [PATCH 023/107] * 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 5b05486aa48c1c725d51939291dac3a6a59ab1fb Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:17:50 +0200 Subject: [PATCH 024/107] =?UTF-8?q?+=20minetestmapper2,=20colors=20modifie?= =?UTF-8?q?d=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 badaf4eb0dad5f03fa2647436cbd40d70aa50ffc Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:52:25 +0200 Subject: [PATCH 025/107] + 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 b11f08d5d22d1c63c824ccfeb7ab58c61371364a Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 16:54:05 +0200 Subject: [PATCH 026/107] * 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 74fd1756c25777c6a28d10859d365449ff81d22f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:13:00 +0200 Subject: [PATCH 027/107] * 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 5df1b218a4833b3ee4eca7134d95eb4db10b7a3b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:19:50 +0200 Subject: [PATCH 028/107] * 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 eeebf632e8d15c7fa7705423657e2012b8525a0c Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 2 Jun 2011 17:21:58 +0200 Subject: [PATCH 029/107] + 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 a080bfa842e2682d13b0e717e95dc30074722fa2 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:52:36 +0200 Subject: [PATCH 030/107] * 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 ccc0420c52d341ea20ff879aac7520179ca24bdf Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:55:28 +0200 Subject: [PATCH 031/107] + 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 799ecd26d5f6573f9396f8b57abdadf922424f91 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:56:27 +0200 Subject: [PATCH 032/107] + 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 176ac0b0bfefaecdfce7956ea351dc23ebabde99 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:57:39 +0200 Subject: [PATCH 033/107] * 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 8835433b5ef23c22b3b84045af6f97dc52883ef1 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:12:56 +0200 Subject: [PATCH 034/107] + 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 f625a22e012e7d750b340c7713c47bfd296a585b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:13:31 +0200 Subject: [PATCH 035/107] * 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 4f7a3bc785dd7bc5a76f6b0c4d3fef04c6f9c25f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:31:42 +0200 Subject: [PATCH 036/107] + 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 a62228ec1e1caf863ae12e8ff6acfca48a9219f0 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:39:07 +0200 Subject: [PATCH 037/107] * 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 3be6891938fec9927854a0f0abe821a6271bba23 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 7 Jun 2011 19:24:30 +0200 Subject: [PATCH 038/107] + 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 1f4bdeab85a60d4f4089800f50122feeea539d34 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 7 Jun 2011 19:41:03 +0200 Subject: [PATCH 039/107] * 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 158b054e72582005d895f1ed0e1cb0c9b22a8e57 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 8 Jun 2011 05:27:51 +0200 Subject: [PATCH 040/107] + 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 */ From 4f44cabe1cdadc926d55f7a24235b618d2c3c163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Sun, 26 Jun 2011 12:52:03 +0200 Subject: [PATCH 041/107] small fix --- doc/README.txt | 238 ++++++++++++++++ makepackage_binary.sh | 63 +++++ src/guiKeyChangeMenu.cpp | 598 +++++++++++++++++++++++++++++++++++++++ src/guiKeyChangeMenu.h | 133 +++++++++ 4 files changed, 1032 insertions(+) create mode 100644 doc/README.txt create mode 100755 makepackage_binary.sh create mode 100644 src/guiKeyChangeMenu.cpp create mode 100644 src/guiKeyChangeMenu.h diff --git a/doc/README.txt b/doc/README.txt new file mode 100644 index 000000000..645e2a560 --- /dev/null +++ b/doc/README.txt @@ -0,0 +1,238 @@ +Minetest-c55 +--------------- +An InfiniMiner/Minecraft inspired game. +Copyright (c) 2010-2011 Perttu Ahola + +Further documentation: +---------------------- +- Website: http://celeron.55.lt/~celeron55/minetest/ +- Wiki: http://celeron.55.lt/~celeron55/minetest/wiki/ +- Forum: http://celeron.55.lt/~celeron55/minetest/forum/ + +This is a development version: +------------------------------ +- Don't expect it to work as well as a finished game will. +- Please report any bugs to me. That way I can fix them to the next release. + - debug.txt is useful when the game crashes. + +Controls: +--------- +- See the in-game pause menu +- Settable in the configuration file, see the section below. + +Map directory: +-------------- +- Map is stored in a directory, which can be removed to generate a new map. +- There is a command-line option for it: --map-dir +- For a RUN_IN_PLACE build, it is located in: + ../map +- Otherwise something like this: + Windows: C:\Documents and Settings\user\Application Data\minetest\map + Linux: ~/.minetest/map + OS X: ~/Library/Application Support/minetest/map + +Configuration file: +------------------- +- An optional configuration file can be used. See minetest.conf.example. +- Path to file can be passed as a parameter to the executable: + --config +- Defaults: + - If built with -DRUN_IN_PLACE=1: + ../minetest.conf + ../../minetest.conf + - Otherwise something like this: + Windows: C:\Documents and Settings\user\Application Data\minetest\minetest.conf + Linux: ~/.minetest/minetest.conf + OS X: ~/Library/Application Support/minetest.conf + +Command-line options: +--------------------- +- Use --help + +Compiling on GNU/Linux: +----------------------- + +Install dependencies. Here's an example for Debian/Ubuntu: +$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev + +Download source, extract (this is the URL to the latest of source repository, which might not work at all times): +$ wget https://bitbucket.org/celeron55/minetest/get/tip.tar.gz +$ tar xf tip.tar.gz +$ cd minetest + +Build a version that runs directly from the source directory: +$ cmake . -DRUN_IN_PLACE=1 +$ make -j2 + +Run it: +$ cd bin +$ ./minetest + +- Use cmake . -LH to see all CMake options and their current state +- If you want to install it system-wide (or are making a distribution package), you will want to use -DRUN_IN_PLACE=0 +- You can build a bare server or a bare client by specifying -DBUILD_CLIENT=0 or -DBUILD_SERVER=0 +- You can select between Release and Debug build by -DCMAKE_BUILD_TYPE= + - Note that the Debug build is considerably slower + +Compiling on Windows: +--------------------- + +- You need: + * CMake: + http://www.cmake.org/cmake/resources/software.html + * MinGW or Visual Studio + http://www.mingw.org/ + http://msdn.microsoft.com/en-us/vstudio/default + * Irrlicht SDK 1.7: + http://irrlicht.sourceforge.net/downloads.html + * Zlib headers (zlib125.zip) + http://www.winimage.com/zLibDll/index.html + * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): + http://www.winimage.com/zLibDll/index.html + * And, of course, Minetest-c55: + http://celeron.55.lt/~celeron55/minetest/download +- Steps: + - Select a directory called DIR hereafter in which you will operate. + - Make sure you have CMake and a compiler installed. + - Download all the other stuff to DIR and extract them into there. All those + packages contain a nice base directory in them, which should end up being + the direct subdirectories of DIR. + - You will end up with a directory structure like this (+=dir, -=file): + ----------------- + + DIR + - zlib-1.2.5.tar.gz + - zlib125dll.zip + - irrlicht-1.7.1.zip + - 110214175330.zip (or whatever, this is the minetest source) + + zlib-1.2.5 + - zlib.h + + win32 + ... + + zlib125dll + - readme.txt + + dll32 + ... + + irrlicht-1.7.1 + + lib + + include + ... + + minetest + + src + + doc + - CMakeLists.txt + ... + ----------------- + - Start up the CMake GUI + - Select "Browse Source..." and select DIR/minetest + - Now, if using MSVC: + - Select "Browse Build..." and select DIR/minetest-build + - Else if using MinGW: + - Select "Browse Build..." and select DIR/minetest + - Select "Configure" + - Select your compiler + - It will warn about missing stuff, ignore that at this point. (later don't) + - Make sure the configuration is as follows + (note that the versions may differ for you): + ----------------- + BUILD_CLIENT [X] + BUILD_SERVER [ ] + CMAKE_BUILD_TYPE Release + CMAKE_INSTALL_PREFIX DIR/minetest-install + IRRLICHT_SOURCE_DIR DIR/irrlicht-1.7.1 + RUN_IN_PLACE [X] + WARN_ALL [ ] + ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll + ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 + ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib + ----------------- + - Hit "Configure" + - Hit "Generate" + If using MSVC: + - Open the generated minetest.sln + - The project defaults to the "Debug" configuration. Make very sure to + select "Release", unless you want to debug some stuff (it's slower) + - Build the ALL_BUILD project + - Build the INSTALL project + - You should now have a working game with the executable in + DIR/minetest-install/bin/minetest.exe + - Additionally you may create a zip package by building the PACKAGE + project. + If using MinGW: + - Using the command line, browse to the build directory and run 'make' + (or mingw32-make or whatever it happens to be) + - You should now have a working game with the executable in + DIR/minetest/bin/minetest.exe + +License of Minetest-c55 +----------------------- + +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 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. + +Irrlicht +--------------- + +This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/ + + The Irrlicht Engine License + +Copyright © 2002-2005 Nikolaus Gebhardt + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute +it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source + distribution. + + +JThread +--------------- + +This program uses the JThread library. License for JThread follows: + +Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + + diff --git a/makepackage_binary.sh b/makepackage_binary.sh new file mode 100755 index 000000000..f00ec608c --- /dev/null +++ b/makepackage_binary.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +PACKAGEDIR=../minetest-packages +PACKAGENAME=minetest-c55-binary-`date +%y%m%d%H%M%S` +PACKAGEPATH=$PACKAGEDIR/$PACKAGENAME + +mkdir -p $PACKAGEPATH +mkdir -p $PACKAGEPATH/bin +mkdir -p $PACKAGEPATH/data +mkdir -p $PACKAGEPATH/doc + +cp minetest.conf.example $PACKAGEPATH/ + +cp bin/minetest.exe $PACKAGEPATH/bin/ +cp bin/Irrlicht.dll $PACKAGEPATH/bin/ +cp bin/zlibwapi.dll $PACKAGEPATH/bin/ +#cp bin/test $PACKAGEPATH/bin/ +#cp bin/fasttest $PACKAGEPATH/bin/ +#cp bin/server $PACKAGEPATH/bin/ +#cp ../irrlicht/irrlicht-1.7.1/lib/Linux/libIrrlicht.a $PACKAGEPATH/bin/ +#cp ../jthread/jthread-1.2.1/src/.libs/libjthread-1.2.1.so $PACKAGEPATH/bin/ + +cp -r data/fontlucida.png $PACKAGEPATH/data/ +cp -r data/player.png $PACKAGEPATH/data/ +cp -r data/player_back.png $PACKAGEPATH/data/ +cp -r data/stone.png $PACKAGEPATH/data/ +cp -r data/grass.png $PACKAGEPATH/data/ +cp -r data/grass_footsteps.png $PACKAGEPATH/data/ +cp -r data/water.png $PACKAGEPATH/data/ +cp -r data/tree.png $PACKAGEPATH/data/ +cp -r data/leaves.png $PACKAGEPATH/data/ +cp -r data/mese.png $PACKAGEPATH/data/ +cp -r data/cloud.png $PACKAGEPATH/data/ +cp -r data/sign.png $PACKAGEPATH/data/ +cp -r data/sign_back.png $PACKAGEPATH/data/ +cp -r data/rat.png $PACKAGEPATH/data/ +cp -r data/mud.png $PACKAGEPATH/data/ +cp -r data/torch.png $PACKAGEPATH/data/ +cp -r data/torch_on_floor.png $PACKAGEPATH/data/ +cp -r data/torch_on_ceiling.png $PACKAGEPATH/data/ +cp -r data/tree_top.png $PACKAGEPATH/data/ +cp -r data/coalstone.png $PACKAGEPATH/data/ +cp -r data/crack.png $PACKAGEPATH/data/ +cp -r data/wood.png $PACKAGEPATH/data/ +cp -r data/stick.png $PACKAGEPATH/data/ +cp -r data/tool_wpick.png $PACKAGEPATH/data/ +cp -r data/tool_stpick.png $PACKAGEPATH/data/ +cp -r data/tool_mesepick.png $PACKAGEPATH/data/ +cp -r data/grass_side.png $PACKAGEPATH/data/ +cp -r data/lump_of_coal.png $PACKAGEPATH/data/ +cp -r data/lump_of_iron.png $PACKAGEPATH/data/ +cp -r data/mineral_coal.png $PACKAGEPATH/data/ +cp -r data/mineral_iron.png $PACKAGEPATH/data/ +cp -r data/sand.png $PACKAGEPATH/data/ + +#cp -r data/pauseMenu.gui $PACKAGEPATH/data/ + +cp -r doc/README.txt $PACKAGEPATH/doc/README.txt + +cd $PACKAGEDIR +rm $PACKAGENAME.zip +zip -r $PACKAGENAME.zip $PACKAGENAME + 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 + From 7efe89ff584b2c0338dcede4c1e08504d0158780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Sun, 26 Jun 2011 13:47:21 +0200 Subject: [PATCH 042/107] backported cactus, papyrus and clay --- data/heart.png | Bin 308 -> 258 bytes heart.png | Bin 258 -> 0 bytes src/mapgen.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 10 deletions(-) delete mode 100644 heart.png diff --git a/data/heart.png b/data/heart.png index 6bc183e04f21cba17b52009e89bb52072d5a0afd..bea1aefd6b22e3268f88db0eb26188b1cb362f81 100644 GIT binary patch delta 210 zcmV;@04@Kt0)hgNBnkm@Qb$4nuFf3kkuey52XskIMF-mj8W%GHKxNM^0001#NklVQ zc5uf$mMgo6z)RnOHGYBE@E2eNX~Qny4B~~m3Xq?rh593L2{H=50gdG}LP=Bz2nYy#2xN$nE*O8-Nkl9#BDbI(Ls&# z%GzuoAEjllO;+D+Z%Dd*{$^t^CUp&JEU@e=UJ*}~yJ%xg%!>0@nGqj71`Tns%ixlj zSHyE-v`gGF%B`+*G+V^gXS^f57lH>&dmg0sA52LHMA{<$AAAB8R%;g2&!{W_0000< KMNUMnLSTZvP;Kl0 diff --git a/heart.png b/heart.png deleted file mode 100644 index bea1aefd6b22e3268f88db0eb26188b1cb362f81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0XB zj({-ZRBb+KpdfpRr>`sfZB{99Vn~*1 zOf;RLoV~^PV*i6<0qnDigqRBVv2zGCh{k7MuAcWI;r8w|tei*K7JX!>6zOP5Hd=1= zq0!~|;tH-6T(g|4=G}RrVR)@*+b<8*$>M6JyaEj$jvIcNwydn+xXm=}-5m$K?>Cy( zHQx9jp1_iMSnmPPqt@MA6Xq{%{iR&UX~eakvG=Lg;u1%PV4(XLJYD@<);T3K0RY|` BTmb+8 diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 801dd72b1..71696a349 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -151,6 +151,34 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) } } +void make_papyrus(VoxelManipulator &vmanip, v3s16 p0) +{ + MapNode papyrusnode(CONTENT_PAPYRUS); + + s16 trunk_h = myrand_range(2, 3); + v3s16 p1 = p0; + for(s16 ii=0; iiseed+4321, 6, 0.95); + + have_clay = have_sand && (claynoise > 1.25); + // Use fast index incrementing s16 start_y = node_max.Y+2; v3s16 em = vmanip.m_area.getExtent(); @@ -1778,7 +1815,10 @@ void make_block(BlockMakeData *data) { if(have_sand) { - vmanip.m_data[i] = MapNode(CONTENT_SAND); + if (have_clay) + vmanip.m_data[i] = MapNode(CONTENT_CLAY); + else + vmanip.m_data[i] = MapNode(CONTENT_SAND); } #if 1 else if(current_depth==0 && !water_detected @@ -1823,7 +1863,7 @@ void make_block(BlockMakeData *data) //s16 y = find_ground_level(data->vmanip, v2s16(x,z)); s16 y = find_ground_level_from_noise(data->seed, v2s16(x,z), 4); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Make sure tree fits (only trees whose starting point is // at this block are added) @@ -1847,19 +1887,36 @@ void make_block(BlockMakeData *data) // If not found, handle next one if(found == false) continue; - /* - Trees grow only on mud and grass - */ + { u32 i = data->vmanip->m_area.index(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; + + // Papyrus grows only on mud and in water + if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + { + p.Y++; + make_papyrus(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) + { + p.Y++; + make_tree(vmanip, p); + } + // Cactii grow only on sand + else if(n->d == CONTENT_SAND) + { + p.Y++; + make_cactus(vmanip, p); + } } - // Tree will be placed one higher - p.Y++; - // Make a tree - make_tree(vmanip, p); } #if 0 From 10caac8839253b1d8e3b52ab455a5d109c54db0f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 9 Jul 2011 18:14:05 +0200 Subject: [PATCH 043/107] + notes regarding upstream conversion from mercurial using hg-fast-export --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 9b1f54e95..1a1b4d4c0 100644 --- a/README +++ b/README @@ -27,3 +27,6 @@ Alternate graphics: Building on GNU/Linux or OS X: cmake . -DRUN_IN_PLACE=1 make -j2 + +The “upstream” branch contains vanilla minetest-c55, created using: + hg-fast-export -r ~/share/src/games/minetest -o upstream From cdd2ebc5196cb82092aac36694e704cdc17bc69b Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 9 Jul 2011 18:22:39 +0200 Subject: [PATCH 044/107] * amended upstream branch notes --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 1a1b4d4c0..13cab5d3b 100644 --- a/README +++ b/README @@ -30,3 +30,4 @@ Building on GNU/Linux or OS X: The “upstream” branch contains vanilla minetest-c55, created using: hg-fast-export -r ~/share/src/games/minetest -o upstream + git push origin upstream/master:upstream -f From 692bd66011774c92cdd6ca7983e47745ab1937d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Proch=C3=A1zka?= Date: Mon, 11 Jul 2011 14:29:59 +0200 Subject: [PATCH 045/107] + farmesh config options --- src/defaultsettings.cpp | 2 ++ src/farmesh.cpp | 14 +++++++------- src/farmesh.h | 3 ++- src/game.cpp | 8 +------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 74d323237..ac1983ed1 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -68,6 +68,8 @@ void set_default_settings() g_settings.setDefault("fast_move", "false"); g_settings.setDefault("invert_mouse", "false"); g_settings.setDefault("enable_farmesh", "false"); + g_settings.setDefault("farmesh_trees", "true"); + g_settings.setDefault("farmesh_distance", "40"); g_settings.setDefault("enable_clouds", "true"); g_settings.setDefault("invisible_stone", "false"); diff --git a/src/farmesh.cpp b/src/farmesh.cpp index 72dbe11c2..a35983729 100644 --- a/src/farmesh.cpp +++ b/src/farmesh.cpp @@ -70,6 +70,7 @@ FarMesh::FarMesh( m_box = core::aabbox3d(-BS*1000000,-BS*31000,-BS*1000000, BS*1000000,BS*31000,BS*1000000); + trees = g_settings.getBool("farmesh_trees"); } FarMesh::~FarMesh() @@ -312,12 +313,11 @@ void FarMesh::render() } else { - /*// Trees if there are over 0.01 trees per MapNode - if(tree_amount_avg > 0.01) + // Trees if there are over 0.01 trees per MapNode + if(trees && tree_amount_avg > 0.01) c = video::SColor(255,50,128,50); else - c = video::SColor(255,107,134,51);*/ - c = video::SColor(255,107,134,51); + c = video::SColor(255,107,134,51); ground_is_mud = true; } } @@ -350,7 +350,7 @@ void FarMesh::render() video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT); // Add some trees if appropriate - if(tree_amount_avg >= 0.0065 && steepness < 1.4 + if(trees && tree_amount_avg >= 0.0065 && steepness < 1.4 && ground_is_mud == true) { driver->setMaterial(m_materials[1]); @@ -403,11 +403,11 @@ void FarMesh::step(float dtime) m_time += dtime; } -void FarMesh::update(v2f camera_p, float brightness, s16 render_range) +void FarMesh::update(v2f camera_p, float brightness) { m_camera_pos = camera_p; m_brightness = brightness; - m_render_range = render_range; + m_render_range = g_settings.getS16("farmesh_distance")*10; } diff --git a/src/farmesh.h b/src/farmesh.h index 0a30a8aef..577224e15 100644 --- a/src/farmesh.h +++ b/src/farmesh.h @@ -67,7 +67,7 @@ public: void step(float dtime); - void update(v2f camera_p, float brightness, s16 render_range); + void update(v2f camera_p, float brightness); private: video::SMaterial m_materials[FARMESH_MATERIAL_COUNT]; @@ -79,6 +79,7 @@ private: float m_time; Client *m_client; s16 m_render_range; + bool trees; }; #endif diff --git a/src/game.cpp b/src/game.cpp index 5632c1805..367abebe1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1874,15 +1874,9 @@ void the_game( */ if(farmesh) { - farmesh_range = draw_control.wanted_range * 10; - if(draw_control.range_all && farmesh_range < 500) - farmesh_range = 500; - if(farmesh_range > 1000) - farmesh_range = 1000; - farmesh->step(dtime); farmesh->update(v2f(player_position.X, player_position.Z), - 0.05+brightness*0.95, farmesh_range); + 0.05+brightness*0.95); } // Store brightness value From 1e88a16dd5e52e0c365be54d8b1e35303e8aaa67 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 11 Jul 2011 16:22:14 +0200 Subject: [PATCH 046/107] * README updated --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 13cab5d3b..094e66f88 100644 --- a/README +++ b/README @@ -2,6 +2,8 @@ Minetest Δ (“Minetest Delta”) is a fork of Minetest-c55 Date: Wed, 13 Jul 2011 16:21:20 +0200 Subject: [PATCH 047/107] * regression fix, papyrus should appear again now --- src/mapgen.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 71696a349..b7e077f68 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1863,7 +1863,7 @@ void make_block(BlockMakeData *data) //s16 y = find_ground_level(data->vmanip, v2s16(x,z)); s16 y = find_ground_level_from_noise(data->seed, v2s16(x,z), 4); // Don't make a tree under water level - if(y < WATER_LEVEL - 1) + if(y < WATER_LEVEL) continue; // Make sure tree fits (only trees whose starting point is // at this block are added) @@ -1878,7 +1878,7 @@ void make_block(BlockMakeData *data) { u32 i = data->vmanip->m_area.index(p); MapNode *n = &data->vmanip->m_data[i]; - if(n->d != CONTENT_AIR && n->d != CONTENT_IGNORE) + if(n->d != CONTENT_AIR && n->d != CONTENT_WATERSOURCE && n->d != CONTENT_IGNORE) { found = true; break; @@ -1896,22 +1896,19 @@ void make_block(BlockMakeData *data) continue; // Papyrus grows only on mud and in water - if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + if(n->d == CONTENT_MUD && y <= WATER_LEVEL) { p.Y++; make_papyrus(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) + // Trees grow only on mud and grass, on land + else if((n->d == CONTENT_MUD || n->d == CONTENT_GRASS) && y > WATER_LEVEL + 2) { p.Y++; make_tree(vmanip, p); } - // Cactii grow only on sand - else if(n->d == CONTENT_SAND) + // Cactii grow only on sand, on land + else if(n->d == CONTENT_SAND && y > WATER_LEVEL + 2) { p.Y++; make_cactus(vmanip, p); From b96450b58666b26e960684b398c54201736e8274 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 13 Jul 2011 23:10:41 +0200 Subject: [PATCH 048/107] * slightly different values for 3d perlin noise --- src/mapgen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index b7e077f68..0fd2e4c82 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -903,8 +903,8 @@ NoiseParams get_cave_noise2_params(u64 seed) NoiseParams get_ground_noise1_params(u64 seed) { - return NoiseParams(NOISE_PERLIN, seed+983240, 5, - 0.60, 100.0, 30.0); + return NoiseParams(NOISE_PERLIN, seed+983240, 4, + 0.55, 80.0, 40.0); } NoiseParams get_ground_crumbleness_params(u64 seed) @@ -939,7 +939,7 @@ bool val_is_ground(double ground_noise1_val, v3s16 p, u64 seed) double f = 0.8 + noise2d_perlin( 0.5+(float)p.X/250, 0.5+(float)p.Z/250, - seed+920381, 3, 0.5); + seed+920381, 3, 0.45); if(f < 0.01) f = 0.01; else if(f >= 1.0) From 5383aa847f1b9d5400def4f2a1b83904dcea9db9 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 13 Jul 2011 23:12:18 +0200 Subject: [PATCH 049/107] * possible fix for large cubic holes in map --- src/mapgen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 0fd2e4c82..a491ac81a 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1317,7 +1317,8 @@ void make_block(BlockMakeData *data) data->seed, v2s16(blockpos.X, blockpos.Z), 1); // Maximum amount of ground above the bottom of the central block s16 maximum_ground_depth = maximum_groundlevel - node_min.Y; - + + #if 0 /* Special case for high air or water: Just fill with air and water. */ @@ -1351,6 +1352,7 @@ void make_block(BlockMakeData *data) // We're done return; } + #endif /* If block is deep underground, this is set to true and ground From 5146c826be9386cc2adeb8f678063a2f9cfc1dee Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 14 Jul 2011 16:17:50 +0200 Subject: [PATCH 050/107] * possibly improved water flow, by flyx86 - When flowing liquid starts to flow down, it stops contributing to its neighboring nodes' liquid level (possibly transforming it back to air) - Flowing liquid turns into a source if there are at least 2 adjacent liquid source nodes - If a new liquid flow reaches existing flowing liquid, the existing liquid is now updated properly. --- src/content_mapnode.cpp | 2 ++ src/map.cpp | 46 ++++++++++++++++++++++++++++++++++------- src/mapnode.h | 4 +++- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index 2e7a240f3..38356599f 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -276,6 +276,7 @@ void content_mapnode_init() f->buildable_to = true; f->liquid_type = LIQUID_FLOWING; f->liquid_alternative_flowing = CONTENT_WATER; + f->liquid_alternative_source = CONTENT_WATERSOURCE; i = CONTENT_WATERSOURCE; f = &content_features(i); @@ -307,6 +308,7 @@ void content_mapnode_init() f->liquid_type = LIQUID_SOURCE; f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; f->liquid_alternative_flowing = CONTENT_WATER; + f->liquid_alternative_source = CONTENT_WATERSOURCE; i = CONTENT_TORCH; f = &content_features(i); diff --git a/src/map.cpp b/src/map.cpp index 0de9cf18e..d3e898357 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1204,16 +1204,24 @@ void Map::removeNodeAndUpdate(v3s16 p, /* Add neighboring liquid nodes to transform queue. + + Also add horizontal neighbors of node on top of removed node + because they could be affected of the water on top flowing + down instead of into them. */ - v3s16 dirs[6] = { + v3s16 dirs[10] = { v3s16(0,0,1), // back v3s16(0,1,0), // top + v3s16(1,1,0), // topright + v3s16(-1,1,0), // topleft + v3s16(0,1,1), // topback + v3s16(0,1,-1), // topfront v3s16(1,0,0), // right v3s16(0,0,-1), // front v3s16(0,-1,0), // bottom v3s16(-1,0,0), // left }; - for(u16 i=0; i<6; i++) + for(u16 i=0; i<10; i++) { try { @@ -1510,6 +1518,9 @@ void Map::transformLiquids(core::map & modified_blocks) // Turn possible source into non-source u8 nonsource_c = make_liquid_flowing(n0.d); + // Counts surrounding liquid source blocks + u8 surrounding_sources = 0; + /* If not source, check that some node flows into this one and what is the level of liquid in this one @@ -1547,7 +1558,9 @@ void Map::transformLiquids(core::map & modified_blocks) } bool n2_is_source = !content_flowing_liquid(n2.d); s8 n2_liquid_level = 8; - if(n2_is_source == false) + if(n2_is_source) + surrounding_sources++; + else n2_liquid_level = n2.param2 & 0x07; s8 new_liquid_level = -1; @@ -1561,7 +1574,20 @@ void Map::transformLiquids(core::map & modified_blocks) } else if(n2_liquid_level > 0) { - new_liquid_level = n2_liquid_level - 1; + // If the neighbor node isn't a source and flows downwards, + // it doesn't flow into this node + if (n2_is_source) + { + new_liquid_level = n2_liquid_level - 1; + } + else + { + // Node below n2 + MapNode n3 = getNodeNoEx(p2 + v3s16(0,-1,0)); + // NOTE: collision of different liquids not yet handled here. + if (content_features(n3.d).liquid_type != LIQUID_FLOWING) + new_liquid_level = n2_liquid_level - 1; + } } if(new_liquid_level > new_liquid_level_max) @@ -1577,9 +1603,14 @@ void Map::transformLiquids(core::map & modified_blocks) If liquid level should be something else, update it and add all the neighboring water nodes to the transform queue. */ - if(new_liquid_level_max != liquid_level) + if(new_liquid_level_max != liquid_level || (!is_source && surrounding_sources >= 2)) { - if(new_liquid_level_max == -1) + if (surrounding_sources >= 2) + { + n0.d = content_features(n0.d).liquid_alternative_source; + setNode(p0,n0); + } + else if(new_liquid_level_max == -1) { // Remove water alltoghether n0.d = CONTENT_AIR; @@ -1589,6 +1620,7 @@ void Map::transformLiquids(core::map & modified_blocks) else { n0.param2 = new_liquid_level_max; + liquid_level = new_liquid_level_max; setNode(p0, n0); } @@ -1706,7 +1738,7 @@ void Map::transformLiquids(core::map & modified_blocks) } else { - if(liquid_next_level > liquid_level) + if(liquid_next_level > n2_liquid_level) { n2.param2 = liquid_next_level; setNode(p2, n2); diff --git a/src/mapnode.h b/src/mapnode.h index d975a50c4..d4ba0fed5 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -141,8 +141,10 @@ struct ContentFeatures NodeMetadata *initial_metadata; // If the content is liquid, this is the flowing version of the liquid. - // If content is liquid, this is the same content. + // If content is flowing liquid, this is the same content. u8 liquid_alternative_flowing; + // If the content is liquid, this is the source version of the liquid. + u8 liquid_alternative_source; // Amount of light the node emits u8 light_source; From 287b735224a905cbc679420aea64c9ac8289c488 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 15 Jul 2011 02:23:41 +0200 Subject: [PATCH 051/107] * possibly nicer trees --- src/mapgen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index d7b6e56c4..bb4785bbf 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -85,7 +85,7 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); - s16 trunk_h = myrand_range(3, 6); + s16 trunk_h = myrand_range(4, 5); v3s16 p1 = p0; for(s16 ii=0; ii leaves_d(new u8[leaves_a.getVolume()]); Buffer leaves_d(leaves_a.getVolume()); for(s32 i=0; i Date: Fri, 15 Jul 2011 06:37:47 +0200 Subject: [PATCH 052/107] * regression fix, clay occurs again now --- src/mapgen.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index bb4785bbf..dfea862a5 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1840,13 +1840,6 @@ void make_block(BlockMakeData *data) bool water_detected = false; bool have_clay = false; - // 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, 6, 0.95); - - have_clay = have_sand && (claynoise > 1.25); - // Use fast index incrementing s16 start_y = node_max.Y+2; v3s16 em = vmanip.m_area.getExtent(); @@ -1873,6 +1866,15 @@ void make_block(BlockMakeData *data) { if(have_sand) { + // 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, 6, 0.95) + 0.5; + + have_clay = (y <= WATER_LEVEL) && (y >= WATER_LEVEL-2) && ( + ((claynoise > 0) && (claynoise < 0.04) && (current_depth == 0)) || + ((claynoise > 0) && (claynoise < 0.12) && (current_depth == 1)) + ); if (have_clay) vmanip.m_data[i] = MapNode(CONTENT_CLAY); else From 5086bd5664a0b7d60ed8aae757bf0312d9f159e4 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 15 Jul 2011 20:16:02 +0200 Subject: [PATCH 053/107] * fix automerge regression --- src/environment.cpp | 78 +++------------------------------------------ 1 file changed, 5 insertions(+), 73 deletions(-) diff --git a/src/environment.cpp b/src/environment.cpp index 0dab54213..d55aa38d1 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -594,7 +594,7 @@ void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_dtime) block->setTimestamp(m_game_time); //dstream<<"Block is "<getBlockNoCreateNoEx(p); if(block==NULL) continue; + // Set current time as timestamp (and let it set ChangedFlag) - block->setTimestamp(m_game_time); } @@ -770,75 +770,7 @@ void ServerEnvironment::step(float dtime) if(block==NULL) continue; - // Get time difference - u32 dtime_s = 0; - u32 stamp = block->getTimestamp(); - if(m_game_time > stamp && stamp != BLOCK_TIMESTAMP_UNDEFINED) - dtime_s = m_game_time - block->getTimestamp(); - - // Set current time as timestamp (and let it set ChangedFlag) - block->setTimestamp(m_game_time); - - //dstream<<"Block is "<m_node_metadata.step((float)dtime_s); - if(changed) - { - MapEditEvent event; - event.type = MEET_BLOCK_NODE_METADATA_CHANGED; - event.p = p; - m_map->dispatchEvent(&event); - - block->setChangedFlag(); - } - - // TODO: Do something - // TODO: Implement usage of ActiveBlockModifier - - // Here's a quick demonstration - v3s16 p0; - for(p0.X=0; p0.XgetPosRelative(); - MapNode n = block->getNodeNoEx(p0); - // Test something: - // Convert all mud under proper day lighting to grass - if(n.d == CONTENT_MUD) - { - if(dtime_s > 300) - { - MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0)); - if(content_features(n_top.d).air_equivalent && - n_top.getLight(LIGHTBANK_DAY) >= 13) - { - n.d = CONTENT_GRASS; - m_map->addNodeWithEvent(p, n); - } - } - } - /* - Convert grass into mud if under something else than air - */ - else if(n.d == CONTENT_GRASS) - { - //if(myrand()%20 == 0) - { - MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0)); - if(n_top.d != CONTENT_AIR - && n_top.d != CONTENT_IGNORE) - { - n.d = CONTENT_MUD; - m_map->addNodeWithEvent(p, n); - } - } - } - } + activateBlock(block); } } @@ -954,8 +886,8 @@ void ServerEnvironment::step(float dtime) n.d = CONTENT_MUD; m_map->addNodeWithEvent(p, n); } - } } + } } } } From 1f243e54b472d758bdf94e185d04ef0b306c5273 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 16 Jul 2011 17:14:58 +0200 Subject: [PATCH 054/107] * README updated --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 094e66f88..6c7b2214c 100644 --- a/README +++ b/README @@ -10,15 +10,15 @@ 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, yields paper) +* Papyrus (plant that grows in shallow water) * 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 * Clay brick (made from lumps of clay in the furnace) -* Paper -* Book (made from 3 paper) +* Paper (made from 3 papyrus horizontally) +* Book (made from 3 paper vertically) Alternate graphics: * Player From 13b2bad54b79aa6209febbb532147d8a219a4282 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 17 Jul 2011 22:33:18 +0200 Subject: [PATCH 055/107] =?UTF-8?q?*=20changed=20GUI=20to=20indicate=20Min?= =?UTF-8?q?etest=20=CE=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game.cpp | 2 +- src/guiPauseMenu.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index d77b45da5..0f858e879 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2021,7 +2021,7 @@ void the_game( endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05; char temptext[300]; - snprintf(temptext, 300, "Minetest-c55 %s (" + snprintf(temptext, 300, "Minetest-delta %s (" "R: range_all=%i" ")" " drawtime=%.0f, beginscenetime=%.0f" diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index d32d1a10b..1a885a6ea 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -166,8 +166,8 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) );*/ std::ostringstream os; - os<<"Minetest-c55\n"; - os<<"by Perttu Ahola\n"; + os<<"Minetest-delta\n"; + os<<"by Perttu Ahola and contributors\n"; os<<"celeron55@gmail.com\n"; os< Date: Mon, 18 Jul 2011 02:09:55 +0200 Subject: [PATCH 056/107] =?UTF-8?q?*=20=D0=9E=D0=BC=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=82=D0=B8=D1=86=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/oerkki1.png | Bin 270 -> 333 bytes data/oerkki1_damaged.png | Bin 341 -> 291 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/oerkki1.png b/data/oerkki1.png index aad2ddb41faada144601bfaaf02cdd814ad4bb97..1256a8a574408a2f1c6096d68c0bdd734c4ea0aa 100644 GIT binary patch literal 333 zcmV-T0kZyyP)Px$2T4RhR9M69Siud0Fbq5>%ka($UC5JUiH^|~@@AUiKA=^JQfjbUk}8(?97gsf zc6y1QMVJR5#ey;iiyatafD%q5{C2B#)?4a7 zyeH#$optg-;A2Um{bll)eSD4tqQ(|sSrTvnu6@5qIE7_PAOJWI!=jv0Sk@&Jgjg;F z+9Tr^FD1+fknp5&#&bZWLtYgnMUyzZIYuclu{C zBJTrJ4>SOH^NRatcvkg*Y6qskJkstG<1vQ|&40{+N}v*`1S)|_pb{uf3(b1y7A?r8 f--Q7tR`(F>Pya`>--rgDardyt7-tj!NVntfK*GJ zF=(8?RtxmTiG*`oEodJp{}?Cb^@4WrN#LUi;r|&tb|0P*V1JaI0uY7Tv;aw{*%eX( z@FUl^6DSi@6h83j@&H#5pZ-E+@LIW`tB@)SxjMu0mlA?2ke-4roOL&8wKuSIKL9vT zV}r$T0P-CD03GNK_c`0;uaE&4fB_hQ0T{sLYoSNAAx-5$0&YF)KLOcyKfrueF0cRq O002ovPDHLkU;%>q19Wu& delta 314 zcmV-A0mc5K0@VVLB!2{RLP=Bz2nYy#2xN!=000SaNLh0L01m_e01m_fl`9S#0002@ zNklkh*p2!&5HFpGb2WBFS-hTy%fR%`%b^)0}N9K-z zAL3tgPC)I{!Cbnb?s3v>%hWwiojMpRfVgn=UQNmajznqbDV`Pwdljiq58n%-i~A*0N_4 z#*ToePI+^~A2YJuTP$3_6FjkhCBP#EM3VxdNdeKMfM`-cG$|mOHxc;s5{u M07*qoM6N<$g0|0v1poj5 From f1e8ff22459bcd4fdbbe855a031d29744640ea99 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Sat, 16 Jul 2011 16:01:37 +0200 Subject: [PATCH 057/107] * refactored liquid transformation code (has some flaws) Completely rewrote the liquid transformation. The algorithm now exclusively modifies the current node in one iteration. Another change is that MapNode.param2 now stores a bit that tells other nodes if a flowing liquid node flows downwards. This is accomplished by two masks on param2 for the "flow down" bit and the "liquid level" bits. This will be the base of future improvements to the liquid flow. However, in the current state flowing liquid does not always disappear when cut off its source. Be aware that this branch is work in progress. --- src/content_mapblock.cpp | 2 +- src/map.cpp | 471 +++++++++++++++++---------------------- src/mapnode.h | 7 + 3 files changed, 218 insertions(+), 262 deletions(-) diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 4c28fe3c6..d8bf71dc0 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -375,7 +375,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data, if(n2.d == CONTENT_WATERSOURCE) level = (-0.5+node_water_level) * BS; else if(n2.d == CONTENT_WATER) - level = (-0.5 + ((float)n2.param2 + 0.5) / 8.0 + level = (-0.5 + ((float)(n2.param2 & LIQUID_LEVEL_MASK) + 0.5) / 8.0 * node_water_level) * BS; // Check node above neighbor. diff --git a/src/map.cpp b/src/map.cpp index 10e1302b1..298826e7e 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1086,7 +1086,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, v3s16 p2 = p + dirs[i]; MapNode n2 = getNode(p2); - if(content_liquid(n2.d)) + if(content_liquid(n2.d) || n2.d == CONTENT_AIR) { m_transforming_liquid.push_back(p2); } @@ -1241,18 +1241,10 @@ void Map::removeNodeAndUpdate(v3s16 p, /* Add neighboring liquid nodes to transform queue. - - Also add horizontal neighbors of node on top of removed node - because they could be affected of the water on top flowing - down instead of into them. */ v3s16 dirs[10] = { v3s16(0,0,1), // back v3s16(0,1,0), // top - v3s16(1,1,0), // topright - v3s16(-1,1,0), // topleft - v3s16(0,1,1), // topback - v3s16(0,1,-1), // topfront v3s16(1,0,0), // right v3s16(0,0,-1), // front v3s16(0,-1,0), // bottom @@ -1266,7 +1258,7 @@ void Map::removeNodeAndUpdate(v3s16 p, v3s16 p2 = p + dirs[i]; MapNode n2 = getNode(p2); - if(content_liquid(n2.d)) + if(content_liquid(n2.d) || n2.d == CONTENT_AIR) { m_transforming_liquid.push_back(p2); } @@ -1546,6 +1538,17 @@ void Map::PrintInfo(std::ostream &out) #define WATER_DROP_BOOST 4 +enum NeighborType { + NEIGHBOR_UPPER, + NEIGHBOR_SAME_LEVEL, + NEIGHBOR_LOWER +}; +struct NodeNeighbor { + MapNode n; + NeighborType t; + v3s16 p; +}; + void Map::transformLiquids(core::map & modified_blocks) { DSTACK(__FUNCTION_NAME); @@ -1565,264 +1568,210 @@ void Map::transformLiquids(core::map & modified_blocks) v3s16 p0 = m_transforming_liquid.pop_front(); MapNode n0 = getNodeNoEx(p0); - - // Don't deal with non-liquids - if(content_liquid(n0.d) == false) - continue; - - bool is_source = !content_flowing_liquid(n0.d); - - u8 liquid_level = 8; - if(is_source == false) - liquid_level = n0.param2 & 0x0f; - - // Turn possible source into non-source - u8 nonsource_c = make_liquid_flowing(n0.d); - - // Counts surrounding liquid source blocks - u8 surrounding_sources = 0; - + /* - If not source, check that some node flows into this one - and what is the level of liquid in this one - */ - if(is_source == false) - { - s8 new_liquid_level_max = -1; - - v3s16 dirs_from[5] = { - v3s16(0,1,0), // top - v3s16(0,0,1), // back - v3s16(1,0,0), // right - v3s16(0,0,-1), // front - v3s16(-1,0,0), // left - }; - for(u16 i=0; i<5; i++) - { - bool from_top = (i==0); - - v3s16 p2 = p0 + dirs_from[i]; - MapNode n2 = getNodeNoEx(p2); - - if(content_liquid(n2.d)) - { - u8 n2_nonsource_c = make_liquid_flowing(n2.d); - // Check that the liquids are the same type - if(n2_nonsource_c != nonsource_c) - { - dstream<<"WARNING: Not handling: different liquids" - " collide"<= 7 - WATER_DROP_BOOST) - new_liquid_level = 7; - else - new_liquid_level = n2_liquid_level + WATER_DROP_BOOST; - } - else if(n2_liquid_level > 0) - { - // If the neighbor node isn't a source and flows downwards, - // it doesn't flow into this node - if (n2_is_source) - { - new_liquid_level = n2_liquid_level - 1; - } - else - { - // Node below n2 - MapNode n3 = getNodeNoEx(p2 + v3s16(0,-1,0)); - // NOTE: collision of different liquids not yet handled here. - if (content_features(n3.d).liquid_type != LIQUID_FLOWING) - new_liquid_level = n2_liquid_level - 1; - } - } - - if(new_liquid_level > new_liquid_level_max) - new_liquid_level_max = new_liquid_level; - } - } //for - - /* - If liquid level should be something else, update it and - add all the neighboring water nodes to the transform queue. - */ - if(new_liquid_level_max != liquid_level || (!is_source && surrounding_sources >= 2)) - { - if (surrounding_sources >= 2) - { - n0.d = content_features(n0.d).liquid_alternative_source; - setNode(p0,n0); - } - else if(new_liquid_level_max == -1) - { - // Remove water alltoghether - n0.d = CONTENT_AIR; - n0.param2 = 0; - setNode(p0, n0); - } - else - { - n0.param2 = new_liquid_level_max; - liquid_level = new_liquid_level_max; - setNode(p0, n0); - } - - // Block has been modified - { - v3s16 blockpos = getNodeBlockPos(p0); - MapBlock *block = getBlockNoCreateNoEx(blockpos); - if(block != NULL) - modified_blocks.insert(blockpos, block); - } - - /* - Add neighboring non-source liquid nodes to transform queue. - */ - v3s16 dirs[6] = { - v3s16(0,0,1), // back - v3s16(0,1,0), // top - v3s16(1,0,0), // right - v3s16(0,0,-1), // front - v3s16(0,-1,0), // bottom - v3s16(-1,0,0), // left - }; - for(u16 i=0; i<6; i++) - { - v3s16 p2 = p0 + dirs[i]; - - MapNode n2 = getNodeNoEx(p2); - if(content_flowing_liquid(n2.d)) - { - m_transforming_liquid.push_back(p2); - } - } - } - } - - // Get a new one from queue if the node has turned into non-water - if(content_liquid(n0.d) == false) - continue; - - /* - Flow water from this node - */ - v3s16 dirs_to[5] = { - v3s16(0,-1,0), // bottom - v3s16(0,0,1), // back - v3s16(1,0,0), // right - v3s16(0,0,-1), // front - v3s16(-1,0,0), // left - }; - for(u16 i=0; i<5; i++) - { - bool to_bottom = (i == 0); - - // If liquid is at lowest possible height, it's not going - // anywhere except down - if(liquid_level == 0 && to_bottom == false) - continue; - - u8 liquid_next_level = 0; - // If going to bottom - if(to_bottom) - { - //liquid_next_level = 7; - if(liquid_level >= 7 - WATER_DROP_BOOST) - liquid_next_level = 7; - else - liquid_next_level = liquid_level + WATER_DROP_BOOST; - } - else - liquid_next_level = liquid_level - 1; - - bool n2_changed = false; - bool flowed = false; - - v3s16 p2 = p0 + dirs_to[i]; - - MapNode n2 = getNodeNoEx(p2); - //dstream<<"[1] n2.param="<<(int)n2.param< n2_liquid_level) - { - n2.param2 = liquid_next_level; - setNode(p2, n2); - - n2_changed = true; - flowed = true; - } - } - } - else if(n2.d == CONTENT_AIR) - { - n2.d = nonsource_c; - n2.param2 = liquid_next_level; - setNode(p2, n2); - - n2_changed = true; - flowed = true; - } - - //dstream<<"[2] n2.param="<<(int)n2.param< 0)) + liquid_kind = content_features(nb.n.d).liquid_alternative_flowing; + if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) { + neutrals[num_neutrals++] = nb; + } else { + // order flowing neighbors by liquid level descending + int insert_at = 0; + while (insert_at < num_flows && ((flows[insert_at].n.param2 & LIQUID_LEVEL_MASK) > + (nb.n.param2 & LIQUID_LEVEL_MASK))) { + insert_at++; + } + flows[insert_at] = nb; + num_flows++; + if (nb.t == NEIGHBOR_LOWER) + flowing_down = true; + } + break; + } + } + + /* + decide on the type (and possibly level) of the current node + */ + u8 new_node_content; + s8 new_node_level = -1; + if (num_sources >= 2 || liquid_type == LIQUID_SOURCE) { + // liquid_kind will be set to either the flowing alternative of the node (if it's a liquid) + // or the flowing alternative of the first of the surrounding sources (if it's air), so + // it's perfectly safe to use liquid_kind here to determine the new node content. + new_node_content = content_features(liquid_kind).liquid_alternative_source; + } else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) { + // liquid_kind is set properly, see above + new_node_content = liquid_kind; + new_node_level = 7; + } else { + // no surrounding sources, so get the maximum level that can flow into this node + for (u16 i = 0; i < num_flows; i++) { + u8 nb_liquid_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); + switch (flows[i].t) { + case NEIGHBOR_UPPER: + if (nb_liquid_level + WATER_DROP_BOOST > new_node_level) { + new_node_level = 7; + if (nb_liquid_level + WATER_DROP_BOOST < 7) + new_node_level = nb_liquid_level + WATER_DROP_BOOST; + } + break; + case NEIGHBOR_LOWER: + break; + case NEIGHBOR_SAME_LEVEL: + if ((flows[i].n.param2 & LIQUID_FLOW_DOWN_MASK) != LIQUID_FLOW_DOWN_MASK && + nb_liquid_level > 0 && nb_liquid_level - 1 > new_node_level) { + new_node_level = nb_liquid_level - 1; + } + break; + } + } + if (new_node_level >= 0) + new_node_content = liquid_kind; + else + new_node_content = CONTENT_AIR; + } + + /* + check if anything has changed. if not, just continue with the next node. + */ + if (new_node_content == n0.d && (content_features(n0.d).liquid_type != LIQUID_FLOWING || + ((n0.param2 & LIQUID_LEVEL_MASK) == (u8)new_node_level) && + ((n0.param2 & LIQUID_FLOW_DOWN_MASK) == LIQUID_FLOW_DOWN_MASK) + == flowing_down)) + continue; + + /* + update the current node + */ + bool flow_down_enabled = (flowing_down && ((n0.param2 & LIQUID_FLOW_DOWN_MASK) != LIQUID_FLOW_DOWN_MASK)); + n0.d = new_node_content; + if (content_features(n0.d).liquid_type == LIQUID_FLOWING) { + // set level to last 3 bits, flowing down bit to 4th bit + n0.param2 = (flowing_down ? LIQUID_FLOW_DOWN_MASK : 0x00) | (new_node_level & LIQUID_LEVEL_MASK); + } else { + n0.param2 = 0; + } + setNode(p0, n0); + v3s16 blockpos = getNodeBlockPos(p0); + MapBlock *block = getBlockNoCreateNoEx(blockpos); + if(block != NULL) + modified_blocks.insert(blockpos, block); + + switch (content_features(n0.d).liquid_type) { + case LIQUID_SOURCE: + // make sure source flows into all neighboring nodes + for (u16 i = 0; i < num_flows; i++) + if (flows[i].t != NEIGHBOR_UPPER) + m_transforming_liquid.push_back(flows[i].p); + for (u16 i = 0; i < num_airs; i++) + if (airs[i].t != NEIGHBOR_UPPER) + m_transforming_liquid.push_back(airs[i].p); + break; + case LIQUID_NONE: + // this flow has turned to air; neighboring flows might need to do the same + for (u16 i = 0; i < num_flows; i++) + m_transforming_liquid.push_back(flows[i].p); + break; + case LIQUID_FLOWING: + for (u16 i = 0; i < num_flows; i++) { + u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); + // liquid_level is still the ORIGINAL level of this node. + if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) || + flow_down_enabled)) + m_transforming_liquid.push_back(flows[i].p); + } + for (u16 i = 0; i < num_airs; i++) { + if (airs[i].t != NEIGHBOR_UPPER && (airs[i].t == NEIGHBOR_LOWER || new_node_level > 0)) + m_transforming_liquid.push_back(airs[i].p); + } + break; + } + loopcount++; //if(loopcount >= 100000) - if(loopcount >= initial_size * 1) + if(loopcount >= initial_size * 1) { break; + } } //dstream<<"Map::transformLiquids(): loopcount="< Date: Sun, 17 Jul 2011 04:01:31 +0200 Subject: [PATCH 058/107] fixed refactoring issues // slowed down water flow a bit * liquid flow no longer does random things when transformed * if a flowi ng liquid node doesn't have a solid block as neighbor, its spread distan ce is shortened by 1 --- src/map.cpp | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 298826e7e..19ed32317 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1240,17 +1240,19 @@ void Map::removeNodeAndUpdate(v3s16 p, } /* - Add neighboring liquid nodes to transform queue. + Add neighboring liquid nodes and this node to transform queue. + (it's vital for the node itself to get updated last.) */ - v3s16 dirs[10] = { + v3s16 dirs[7] = { v3s16(0,0,1), // back v3s16(0,1,0), // top v3s16(1,0,0), // right v3s16(0,0,-1), // front v3s16(0,-1,0), // bottom v3s16(-1,0,0), // left + v3s16(0,0,0), // self }; - for(u16 i=0; i<10; i++) + for(u16 i=0; i<7; i++) { try { @@ -1602,7 +1604,7 @@ void Map::transformLiquids(core::map & modified_blocks) v3s16( 1, 0, 0), // right v3s16(-1, 0, 0), // left v3s16( 0, 0, 1), // back - v3s16( 0, 0,-1) // front + v3s16( 0, 0,-1), // front }; NodeNeighbor sources[6]; // surrounding sources int num_sources = 0; @@ -1655,11 +1657,13 @@ void Map::transformLiquids(core::map & modified_blocks) neutrals[num_neutrals++] = nb; } else { // order flowing neighbors by liquid level descending - int insert_at = 0; + u16 insert_at = 0; while (insert_at < num_flows && ((flows[insert_at].n.param2 & LIQUID_LEVEL_MASK) > (nb.n.param2 & LIQUID_LEVEL_MASK))) { insert_at++; } + for (u16 j = insert_at; j < num_flows; j++) + flows[j + 1] = flows[j]; flows[insert_at] = nb; num_flows++; if (nb.t == NEIGHBOR_LOWER) @@ -1705,6 +1709,20 @@ void Map::transformLiquids(core::map & modified_blocks) break; } } + // don't flow as far in open terrain - if there isn't at least one adjacent solid block, + // substract another unit from the resulting water level. + if (!flowing_down && new_node_level >= 1) { + bool at_wall = false; + for (u16 i = 0; i < num_neutrals; i++) { + if (neutrals[i].t == NEIGHBOR_SAME_LEVEL) { + at_wall = true; + break; + } + } + if (!at_wall) + new_node_level -= 1; + } + if (new_node_level >= 0) new_node_content = liquid_kind; else @@ -1715,11 +1733,12 @@ void Map::transformLiquids(core::map & modified_blocks) check if anything has changed. if not, just continue with the next node. */ if (new_node_content == n0.d && (content_features(n0.d).liquid_type != LIQUID_FLOWING || - ((n0.param2 & LIQUID_LEVEL_MASK) == (u8)new_node_level) && + ((n0.param2 & LIQUID_LEVEL_MASK) == (u8)new_node_level && ((n0.param2 & LIQUID_FLOW_DOWN_MASK) == LIQUID_FLOW_DOWN_MASK) - == flowing_down)) + == flowing_down))) continue; + /* update the current node */ @@ -1737,6 +1756,9 @@ void Map::transformLiquids(core::map & modified_blocks) if(block != NULL) modified_blocks.insert(blockpos, block); + /* + enqueue neighbors for update if neccessary + */ switch (content_features(n0.d).liquid_type) { case LIQUID_SOURCE: // make sure source flows into all neighboring nodes From b7862805c8d6228ad7302887e72c12d644da6dd1 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Sun, 17 Jul 2011 13:15:33 +0200 Subject: [PATCH 059/107] fixes to liquid transformation --- src/map.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 19ed32317..1596f12ef 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1651,7 +1651,7 @@ void Map::transformLiquids(core::map & modified_blocks) case LIQUID_FLOWING: // if this node is not (yet) of a liquid type, choose the first liquid type we encounter // (while ignoring flowing liquids at the lowest level, which cannot flow into this node) - if (liquid_kind == CONTENT_AIR && ((nb.n.param2 & LIQUID_LEVEL_MASK) > 0)) + if (liquid_kind == CONTENT_AIR) liquid_kind = content_features(nb.n.d).liquid_alternative_flowing; if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) { neutrals[num_neutrals++] = nb; @@ -1746,7 +1746,7 @@ void Map::transformLiquids(core::map & modified_blocks) n0.d = new_node_content; if (content_features(n0.d).liquid_type == LIQUID_FLOWING) { // set level to last 3 bits, flowing down bit to 4th bit - n0.param2 = (flowing_down ? LIQUID_FLOW_DOWN_MASK : 0x00) | (new_node_level & LIQUID_LEVEL_MASK); + n0.param2 = (flowing_down ? LIQUID_FLOW_DOWN_MASK : 0x00) | (new_node_level & LIQUID_LEVEL_MASK); } else { n0.param2 = 0; } @@ -1776,10 +1776,10 @@ void Map::transformLiquids(core::map & modified_blocks) break; case LIQUID_FLOWING: for (u16 i = 0; i < num_flows; i++) { - u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); + /*u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); // liquid_level is still the ORIGINAL level of this node. if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) || - flow_down_enabled)) + flow_down_enabled))*/ m_transforming_liquid.push_back(flows[i].p); } for (u16 i = 0; i < num_airs; i++) { @@ -1791,7 +1791,7 @@ void Map::transformLiquids(core::map & modified_blocks) loopcount++; //if(loopcount >= 100000) - if(loopcount >= initial_size * 1) { + if(loopcount >= initial_size * 10) { break; } } From 466f9d87b655e743499e78b39c6c31c781fed422 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Sun, 17 Jul 2011 13:55:59 +0200 Subject: [PATCH 060/107] final fixes to liquid flow, works now as intended --- src/map.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 1596f12ef..cf8692bff 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1612,7 +1612,7 @@ void Map::transformLiquids(core::map & modified_blocks) int num_flows = 0; NodeNeighbor airs[6]; // surrounding air int num_airs = 0; - NodeNeighbor neutrals[6]; // nodes that are solid, another kind of liquid + NodeNeighbor neutrals[6]; // nodes that are solid or another kind of liquid int num_neutrals = 0; bool flowing_down = false; for (u16 i = 0; i < 6; i++) { @@ -1631,7 +1631,7 @@ void Map::transformLiquids(core::map & modified_blocks) case LIQUID_NONE: if (nb.n.d == CONTENT_AIR) { airs[num_airs++] = nb; - // if the current nodes happens to be a flowing node, it will start to flow down here. + // if the current node happens to be a flowing node, it will start to flow down here. if (nb.t == NEIGHBOR_LOWER) flowing_down = true; } else { @@ -1650,22 +1650,12 @@ void Map::transformLiquids(core::map & modified_blocks) break; case LIQUID_FLOWING: // if this node is not (yet) of a liquid type, choose the first liquid type we encounter - // (while ignoring flowing liquids at the lowest level, which cannot flow into this node) if (liquid_kind == CONTENT_AIR) liquid_kind = content_features(nb.n.d).liquid_alternative_flowing; if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) { neutrals[num_neutrals++] = nb; } else { - // order flowing neighbors by liquid level descending - u16 insert_at = 0; - while (insert_at < num_flows && ((flows[insert_at].n.param2 & LIQUID_LEVEL_MASK) > - (nb.n.param2 & LIQUID_LEVEL_MASK))) { - insert_at++; - } - for (u16 j = insert_at; j < num_flows; j++) - flows[j + 1] = flows[j]; - flows[insert_at] = nb; - num_flows++; + flows[num_flows++] = nb; if (nb.t == NEIGHBOR_LOWER) flowing_down = true; } @@ -1776,10 +1766,10 @@ void Map::transformLiquids(core::map & modified_blocks) break; case LIQUID_FLOWING: for (u16 i = 0; i < num_flows; i++) { - /*u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); + u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); // liquid_level is still the ORIGINAL level of this node. if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) || - flow_down_enabled))*/ + flow_down_enabled)) m_transforming_liquid.push_back(flows[i].p); } for (u16 i = 0; i < num_airs; i++) { From 890d3468e757421629b31dca9198677bdd974f50 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 18 Jul 2011 22:50:14 +0200 Subject: [PATCH 061/107] + volumetric clouds (thanks teddydestodes) --- src/clouds.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/src/clouds.cpp b/src/clouds.cpp index 122beedac..022550414 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -125,22 +125,73 @@ void Clouds::render() m_seed, 3, 0.4); if(noise < 0.8) continue; - - v2f p1 = p0 + v2f(1,1)*cloud_size; - //video::SColor c(128,255,255,255); float b = m_brightness; video::SColor c(128,b*230,b*230,b*255); - video::S3DVertex vertices[4] = + + video::S3DVertex v[4] = { - video::S3DVertex(p0.X,m_cloud_y,p0.Y, 0,0,0, c, 0,1), - video::S3DVertex(p0.X,m_cloud_y,p1.Y, 0,0,0, c, 1,1), - video::S3DVertex(p1.X,m_cloud_y,p1.Y, 0,0,0, c, 1,0), - video::S3DVertex(p1.X,m_cloud_y,p0.Y, 0,0,0, c, 0,0), + video::S3DVertex(0,0,0, 0,0,0, c, 0, 1), + video::S3DVertex(0,0,0, 0,0,0, c, 1, 1), + video::S3DVertex(0,0,0, 0,0,0, c, 1, 0), + video::S3DVertex(0,0,0, 0,0,0, c, 0, 0) }; - u16 indices[] = {0,1,2,2,3,0}; - driver->drawVertexPrimitiveList(vertices, 4, indices, 2, - video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT); + + f32 rx = cloud_size; + f32 ry = 16*BS; + f32 rz = cloud_size; + + for(int i=0;i<6;i++) + { + switch(i) + { + case 0: // top + v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; + v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; + v[2].Pos.X= rx; v[2].Pos.Y= ry; v[2].Pos.Z= rz; + v[3].Pos.X= rx; v[3].Pos.Y= ry, v[3].Pos.Z=-rz; + break; + case 1: // back + v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; + v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; + v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; + v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; + break; + case 2: //right + v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; + v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; + v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; + v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; + break; + case 3: // front + v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; + v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; + v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; + v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; + break; + case 4: // left + v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; + v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; + v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; + v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; + break; + case 5: // bottom + v[0].Pos.X= rx; v[0].Pos.Y=-ry; v[0].Pos.Z= rz; + v[1].Pos.X=-rx; v[1].Pos.Y=-ry; v[1].Pos.Z= rz; + v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; + v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; + break; + } + + v3f pos = v3f(p0.X,m_cloud_y,p0.Y); + + for(u16 i=0; i<4; i++) + v[i].Pos += pos; + u16 indices[] = {0,1,2,2,3,0}; + driver->drawVertexPrimitiveList(v, 4, indices, 2, + video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT); + } + } } From a99b7e6e050c40d95d788d2dec56bf3b56c5844f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 19 Jul 2011 01:43:30 +0200 Subject: [PATCH 062/107] + fake shading for the volumetric clouds --- src/clouds.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/clouds.cpp b/src/clouds.cpp index 022550414..19bcca942 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -127,18 +127,21 @@ void Clouds::render() continue; float b = m_brightness; - video::SColor c(128,b*230,b*230,b*255); + video::SColor c_top(128,b*240,b*240,b*255); + video::SColor c_side_1(128,b*230,b*230,b*255); + video::SColor c_side_2(128,b*220,b*220,b*245); + video::SColor c_bottom(128,b*205,b*205,b*230); video::S3DVertex v[4] = { - video::S3DVertex(0,0,0, 0,0,0, c, 0, 1), - video::S3DVertex(0,0,0, 0,0,0, c, 1, 1), - video::S3DVertex(0,0,0, 0,0,0, c, 1, 0), - video::S3DVertex(0,0,0, 0,0,0, c, 0, 0) + video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 1), + video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 1), + video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 0), + video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 0) }; f32 rx = cloud_size; - f32 ry = 16*BS; + f32 ry = 8*BS; f32 rz = cloud_size; for(int i=0;i<6;i++) @@ -152,30 +155,40 @@ void Clouds::render() v[3].Pos.X= rx; v[3].Pos.Y= ry, v[3].Pos.Z=-rz; break; case 1: // back + for(int j=0;j<4;j++) + v[j].Color=c_side_1; v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; break; case 2: //right + for(int j=0;j<4;j++) + v[j].Color=c_side_2; v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; break; case 3: // front + for(int j=0;j<4;j++) + v[j].Color=c_side_1; v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; break; case 4: // left + for(int j=0;j<4;j++) + v[j].Color=c_side_2; v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; break; case 5: // bottom + for(int j=0;j<4;j++) + v[j].Color=c_bottom; v[0].Pos.X= rx; v[0].Pos.Y=-ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y=-ry; v[1].Pos.Z= rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; From 57fcfb2b0d90f14b89f9844c8b59bcaa7bb86b85 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 19 Jul 2011 02:02:50 +0200 Subject: [PATCH 063/107] * initialize liquid_kind properly so compiler does not bitch about it --- src/map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.cpp b/src/map.cpp index cf8692bff..aa064637f 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1575,7 +1575,7 @@ void Map::transformLiquids(core::map & modified_blocks) Collect information about current node */ s8 liquid_level = -1; - u8 liquid_kind; + u8 liquid_kind = CONTENT_IGNORE; LiquidType liquid_type = content_features(n0.d).liquid_type; switch (liquid_type) { case LIQUID_SOURCE: From 2470bce7c2dbc229867e7d0f339af5053c52908d Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 19 Jul 2011 23:32:01 +0200 Subject: [PATCH 064/107] + minetest application icon --- minetest-icon.svg | 183 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 minetest-icon.svg diff --git a/minetest-icon.svg b/minetest-icon.svg new file mode 100644 index 000000000..46c9ac702 --- /dev/null +++ b/minetest-icon.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 41919edb2f155f7c9be6a73a2a036824fd338bb6 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 19 Jul 2011 23:35:12 +0200 Subject: [PATCH 065/107] * README updated --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 6c7b2214c..bf608cc88 100644 --- a/README +++ b/README @@ -4,6 +4,7 @@ New features: * Submenu for key assignment (changes apply after restart) * configurable far mesh tree display (boolean) * configurable far mesh rendering distance +* volumetric clouds (using fake shading) New bricks: * Sandstone (crafted from 4 sand, yields sand) @@ -25,6 +26,7 @@ Alternate graphics: * Omsk birds (instead of Oerkki ghosts) * Rat * Glass +* Heart Building on GNU/Linux or OS X: cmake . -DRUN_IN_PLACE=1 From 6791c856b27fb48bf8676f5a3f66c9f6cd1b43c4 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 20 Jul 2011 02:44:51 +0200 Subject: [PATCH 066/107] * by popular request, fewer clouds --- src/clouds.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clouds.cpp b/src/clouds.cpp index 19bcca942..d754cc15e 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -84,7 +84,7 @@ void Clouds::render() */ const s16 cloud_radius_i = 12; - const float cloud_size = BS*50; + const float cloud_size = BS*48; const v2f cloud_speed(-BS*2, 0); // Position of cloud noise origin in world coordinates @@ -123,7 +123,7 @@ void Clouds::render() (float)p_in_noise_i.X*cloud_size/BS/200, (float)p_in_noise_i.Y*cloud_size/BS/200, m_seed, 3, 0.4); - if(noise < 0.8) + if(noise < 0.95) continue; float b = m_brightness; From 2095b1581615f7b8c4f008886837fbbeaf75faec Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 20 Jul 2011 02:45:15 +0200 Subject: [PATCH 067/107] * README updated (graphics licensing) --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index bf608cc88..65a288161 100644 --- a/README +++ b/README @@ -35,3 +35,5 @@ Building on GNU/Linux or OS X: The “upstream” branch contains vanilla minetest-c55, created using: hg-fast-export -r ~/share/src/games/minetest -o upstream git push origin upstream/master:upstream -f + +All new/replaced graphics done by erlehmann are dual-licensed under GPL (version 2 or, at your option, any later version) and CC-BY-SA (version 3.0 or, at your option, any later version). From 6a8328de7970edd2a1c0472289a903a75ad9daf7 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Wed, 20 Jul 2011 16:51:19 +0200 Subject: [PATCH 068/107] added gettext support german translation file and bashscript to update translations --- README.txt | 10 ++++ po/de/minetest-c55.po | 121 ++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 41 +++++++++++++ src/gettext.h | 12 ++++ src/guiMainMenu.cpp | 26 ++++---- src/guiMessageMenu.cpp | 4 +- src/guiPasswordChange.cpp | 16 +++-- src/guiPauseMenu.cpp | 36 ++++++------ src/guiTextInputMenu.cpp | 4 +- src/main.cpp | 5 ++ updatelocales.sh | 4 ++ 11 files changed, 237 insertions(+), 42 deletions(-) create mode 100644 po/de/minetest-c55.po create mode 100644 src/gettext.h create mode 100644 updatelocales.sh diff --git a/README.txt b/README.txt index 41048992e..662f2770b 100644 --- a/README.txt +++ b/README.txt @@ -90,6 +90,8 @@ Compiling on Windows: http://www.winimage.com/zLibDll/index.html * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): http://www.winimage.com/zLibDll/index.html + * gettext bibrary and tools: + http://gnuwin32.sourceforge.net/downlinks/gettext.php * And, of course, Minetest-c55: http://celeron.55.lt/~celeron55/minetest/download - Steps: @@ -117,6 +119,10 @@ Compiling on Windows: + lib + include ... + + gettext + +bin + +include + +lib + minetest + src + doc @@ -145,6 +151,10 @@ Compiling on Windows: ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib + GETTEXT_BIN_DIR DIR/gettext/bin + GETTEXT_INCLUDE_DIR DIR/gettext/include + GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib + GETTEXT_MSGFMT DIR/gettext/bin/msgfmt ----------------- - Hit "Configure" - Hit "Generate" diff --git a/po/de/minetest-c55.po b/po/de/minetest-c55.po new file mode 100644 index 000000000..58c977f07 --- /dev/null +++ b/po/de/minetest-c55.po @@ -0,0 +1,121 @@ +# German translations for minetest-c55 package. +# Copyright (C) 2011 celeron +# This file is distributed under the same license as the minetest-c55 package. +# Constantin Wenger , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: 0.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-07-20 16:03+0200\n" +"PO-Revision-Date: 2011-07-20 16:04+0100\n" +"Last-Translator: Constantin Wenger \n" +"Language-Team: Deutsch <>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: src/guiMainMenu.cpp:173 +msgid "Name/Password" +msgstr "Name/Passwort" + +#: src/guiMainMenu.cpp:195 +msgid "Address/Port" +msgstr "Adresse / Port" + +#: src/guiMainMenu.cpp:214 +msgid "Leave address blank to start a local server." +msgstr "Lasse die Adresse frei um einen eigenen Server zu starten" + +#: src/guiMainMenu.cpp:220 +msgid "Fancy trees" +msgstr "Schöne Bäume" + +#: src/guiMainMenu.cpp:226 +msgid "Smooth Lighting" +msgstr "Besseres Licht" + +#: src/guiMainMenu.cpp:233 +msgid "Start Game / Connect" +msgstr "Spiel starten / Verbinden" + +#: src/guiMainMenu.cpp:256 +msgid "Creative Mode" +msgstr "Kreativitätsmodus" + +#: src/guiMainMenu.cpp:261 +msgid "Enable Damage" +msgstr "Schaden einschalten" + +#: src/guiMainMenu.cpp:268 +msgid "Delete world" +msgstr "Welt löschen" + +#: src/guiMessageMenu.cpp:92 +#: src/guiTextInputMenu.cpp:110 +msgid "Proceed" +msgstr "Fortsetzen" + +#: src/guiPasswordChange.cpp:102 +msgid "Old Password" +msgstr "Altes Passwort" + +#: src/guiPasswordChange.cpp:116 +msgid "New Password" +msgstr "Neues Passwort" + +#: src/guiPasswordChange.cpp:129 +msgid "Confirm Password" +msgstr "Passwort wiederholen" + +#: src/guiPasswordChange.cpp:143 +msgid "Change" +msgstr "Ändern" + +#: src/guiPasswordChange.cpp:151 +msgid "Passwords do not match!" +msgstr "Passwörter passen nicht zusammen" + +#: src/guiPauseMenu.cpp:109 +msgid "Continue" +msgstr "Weiter" + +#: src/guiPauseMenu.cpp:115 +msgid "Change Password" +msgstr "Passwort ändern" + +#: src/guiPauseMenu.cpp:121 +msgid "Disconnect" +msgstr "Verbindung trennen" + +#: src/guiPauseMenu.cpp:127 +msgid "Exit to OS" +msgstr "Programm beenden" + +#: src/guiPauseMenu.cpp:134 +msgid "" +"Keys:\n" +"- WASD: Walk\n" +"- Mouse left: dig blocks\n" +"- Mouse right: place blocks\n" +"- Mouse wheel: select item\n" +"- 0...9: select item\n" +"- Shift: sneak\n" +"- R: Toggle viewing all loaded chunks\n" +"- I: Inventory menu\n" +"- ESC: This menu\n" +"- T: Chat\n" +msgstr "" +"Tastenkürzel:\n" +"- WASD: Gehen\n" +"- linke Maustaste: dig blocks\n" +"- rechte Maustaste: place blocks\n" +"- Mausrad: Item auswählen\n" +"- 0...9: Item auswählen\n" +"- Shift: ducken\n" +"- R: Alle geladenen Kartenteile anzeigen, umschalten\n" +"- I: Inventarmenü\n" +"- T: Chat\n" + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dfe5b5753..fd1591423 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,6 +27,14 @@ if(WIN32) CACHE FILEPATH "Path to zlibwapi.lib") set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll" CACHE FILEPATH "Path to zlibwapi.dll (for installation)") + set(GETTEXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../gettext/include" + CACHE PATH "gettext include directory") + set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin" + CACHE PATH "gettext bin directory") + set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/intl.lib" + CACHE FILEPATH "gettext intl.lib") + set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2" + CACHE PATH "irrlicht dir") else() # Unix probably if(BUILD_CLIENT) @@ -134,6 +142,7 @@ include_directories( ${ZLIB_INCLUDE_DIR} ${CMAKE_BUILD_TYPE} ${PNG_INCLUDE_DIR} + ${GETTEXT_INCLUDE_DIR} "${PROJECT_SOURCE_DIR}/jthread" "${PROJECT_SOURCE_DIR}/sqlite" ) @@ -151,6 +160,7 @@ if(BUILD_CLIENT) ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${X11_LIBRARIES} + ${GETTEXT_LIBRARIES} ${PLATFORM_LIBS} ${CLIENT_PLATFORM_LIBS} jthread @@ -208,6 +218,10 @@ else() set(ARCH i386) endif() + if(WIN32) + set(CMAKE_EXE_LINKER_FLAGS "-lintl -L ${GETTEXT_BIN_DIR}") + endif() + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}") @@ -239,6 +253,8 @@ if(BUILD_CLIENT) install(FILES ${images} DESTINATION ${DATADIR}) + install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo DESTINATION locale/de/LC_MESSAGES) + if(WIN32) if(DEFINED IRRLICHT_DLL) install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) @@ -246,6 +262,10 @@ if(BUILD_CLIENT) if(DEFINED ZLIB_DLL) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) endif() + if(DEFINED GETTEXT_BIN_DIR) + install(FILES ${GETTEXT_BIN_DIR}/libintl3.dll DESTINATION ${BINDIR}) + install(FILES ${GETTEXT_BIN_DIR}/libiconv2.dll DESTINATION ${BINDIR}) + endif() endif() endif(BUILD_CLIENT) @@ -253,6 +273,27 @@ if(BUILD_SERVER) install(TARGETS minetestserver DESTINATION ${BINDIR}) endif(BUILD_SERVER) +if(WIN32) + set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") +elseif(APPLE) + set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") +else() + set(GETTEXT_MSGFMT "msgfmt") +endif() + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") + +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo + COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po + DEPENDS + ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES + ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de + COMMENT "mo-update [de]: Creating mo file." + ) +add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo) + # Subdirectories add_subdirectory(jthread) diff --git a/src/gettext.h b/src/gettext.h new file mode 100644 index 000000000..7f5f56e49 --- /dev/null +++ b/src/gettext.h @@ -0,0 +1,12 @@ +#include +#define _(String) gettext(String) +#define gettext_noop(String) String +#define N_(String) gettext_noop (String) + +inline wchar_t* chartowchar_t(char *str) +{ + size_t l = strlen(str)+1; + wchar_t* nstr = new wchar_t[l]; + mbstowcs(nstr, str, l); + return nstr; +} diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index cea32860b..f557f4dc0 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., +#include "gettext.h" + GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, @@ -175,8 +177,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, 50+6); - const wchar_t *text = L"Name/Password"; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Name/Password")), rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -198,8 +199,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, 100+6); - const wchar_t *text = L"Address/Port"; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Address/Port")), rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -217,28 +217,26 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) } { core::rect rect(0, 0, 400, 20); - rect += topleft_client + v2s32(160, 100+35); - const wchar_t *text = L"Leave address blank to start a local server."; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Leave address blank to start a local server.")), rect, false, true, this, -1); } { core::rect rect(0, 0, 250, 30); rect += topleft_client + v2s32(35, 150); Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, - L"Fancy trees"); + chartowchar_t(gettext("Fancy trees"))); } { core::rect rect(0, 0, 250, 30); rect += topleft_client + v2s32(35, 150+30); Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, - L"Smooth Lighting"); + chartowchar_t(gettext("Smooth Lighting"))); } // Start game button { 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, GUI_ID_JOIN_GAME_BUTTON, L"Start Game / Connect"); + Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, chartowchar_t(gettext("Start Game / Connect"))); } // Key change button @@ -246,7 +244,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) 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"); + Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, chartowchar_t(gettext("Change keys"))); } /* Server section @@ -268,19 +266,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, GUI_ID_CREATIVE_CB, L"Creative Mode"); + Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, chartowchar_t(gettext("Creative Mode"))); } { core::rect rect(0, 0, 250, 30); rect += topleft_server + v2s32(35, 60); - Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, L"Enable Damage"); + Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, chartowchar_t(gettext("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, GUI_ID_DELETE_MAP_BUTTON, L"Delete map"); + Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, chartowchar_t(gettext("Delete map"))); } } diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp index 192911355..e4e582ab1 100644 --- a/src/guiMessageMenu.cpp +++ b/src/guiMessageMenu.cpp @@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "serialization.h" #include +#include "gettext.h" + GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, @@ -87,7 +89,7 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); gui::IGUIElement *e = - Environment->addButton(rect, this, 257, L"Proceed"); + Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed"))); Environment->setFocus(e); } } diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index ec1cd029a..79601a99f 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -21,6 +21,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "serialization.h" #include +#include "gettext.h" + const int ID_oldPassword = 256; const int ID_newPassword1 = 257; const int ID_newPassword2 = 258; @@ -97,8 +99,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - const wchar_t *text = L"Old Password"; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Old Password")), rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -112,8 +113,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - const wchar_t *text = L"New Password"; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("New Password")), rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -126,8 +126,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - const wchar_t *text = L"Confirm Password"; - Environment->addStaticText(text, rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Confirm Password")), rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -141,16 +140,15 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, ypos); - Environment->addButton(rect, this, ID_change, L"Change"); + Environment->addButton(rect, this, ID_change, chartowchar_t(gettext("Change"))); } ypos += 50; { core::rect rect(0, 0, 300, 20); rect += topleft_client + v2s32(35, ypos); - const wchar_t *text = L"Passwords do not match!"; IGUIElement *e = - Environment->addStaticText(text, rect, false, true, this, ID_message); + Environment->addStaticText(chartowchar_t(gettext("Passwords do not match!")), rect, false, true, this, ID_message); e->setVisible(false); } diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index 1a885a6ea..5f40a4820 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -24,6 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "main.h" +#include "gettext.h" + GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IGameCallback *gamecallback, @@ -104,43 +106,43 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 256, L"Continue"); + Environment->addButton(rect, this, 256, chartowchar_t(gettext("Continue"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 261, L"Change Password"); + Environment->addButton(rect, this, 261, chartowchar_t(gettext("Change Password"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 260, L"Disconnect"); + Environment->addButton(rect, this, 260, chartowchar_t(gettext("Disconnect"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 257, L"Exit to OS"); + Environment->addButton(rect, this, 257, chartowchar_t(gettext("Exit to OS"))); } { core::rect rect(0, 0, 180, 240); rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2); - const wchar_t *text = - L"Keys:\n" - L"- WASD: Walk\n" - L"- Mouse left: dig blocks\n" - L"- Mouse right: place blocks\n" - L"- Mouse wheel: select item\n" - L"- 0...9: select item\n" - L"- Shift: sneak\n" - L"- R: Toggle viewing all loaded chunks\n" - L"- I: Inventory menu\n" - L"- ESC: This menu\n" - L"- T: Chat\n"; - Environment->addStaticText(text, rect, false, true, this, 258); + Environment->addStaticText(chartowchar_t(gettext( + "Keys:\n" + "- WASD: Walk\n" + "- Mouse left: dig blocks\n" + "- Mouse right: place blocks\n" + "- Mouse wheel: select item\n" + "- 0...9: select item\n" + "- Shift: sneak\n" + "- R: Toggle viewing all loaded chunks\n" + "- I: Inventory menu\n" + "- ESC: This menu\n" + "- T: Chat\n" + )), rect, false, true, this, 258); } { core::rect rect(0, 0, 180, 220); diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp index 2cb8cae62..b15f8bc07 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "serialization.h" #include +#include "gettext.h" + GUITextInputMenu::GUITextInputMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, @@ -105,7 +107,7 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); - Environment->addButton(rect, this, 257, L"Proceed"); + Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed"))); } } diff --git a/src/main.cpp b/src/main.cpp index 698c5fc71..1cc479d65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -401,6 +401,8 @@ Doing currently: #include "keycode.h" #include "tile.h" +#include "gettext.h" + // This makes textures ITextureSource *g_texturesource = NULL; @@ -1058,6 +1060,9 @@ int main(int argc, char *argv[]) std::locale::global(std::locale("C")); // This enables printing all characters in bitmap font setlocale(LC_CTYPE, "en_US"); + setlocale(LC_ALL, ""); + bindtextdomain("minetest-c55", "./../locale"); + textdomain("minetest-c55"); /* Parse command line diff --git a/updatelocales.sh b/updatelocales.sh new file mode 100644 index 000000000..1ac42342d --- /dev/null +++ b/updatelocales.sh @@ -0,0 +1,4 @@ +#! /bin/bash +xgettext -n -o minetest-c55.pot ./src/*.cpp ./src/*.h +msgmerge -U ./po/de/minetest-c55.po minetest-c55.pot +rm minetest-c55.pot From e787e16a833a988e9658dbfe556cc2cc1d7d0714 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Wed, 20 Jul 2011 17:00:54 +0200 Subject: [PATCH 069/107] updated german po file for minetest-delta (prior it was for minetest) set +x on bashscript --- po/de/minetest-c55.po | 30 +++++++++++++++++------------- updatelocales.sh | 0 2 files changed, 17 insertions(+), 13 deletions(-) mode change 100644 => 100755 updatelocales.sh diff --git a/po/de/minetest-c55.po b/po/de/minetest-c55.po index 58c977f07..c5ec1c7a0 100644 --- a/po/de/minetest-c55.po +++ b/po/de/minetest-c55.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-20 16:03+0200\n" -"PO-Revision-Date: 2011-07-20 16:04+0100\n" +"POT-Creation-Date: 2011-07-20 16:57+0200\n" +"PO-Revision-Date: 2011-07-20 16:58+0100\n" "Last-Translator: Constantin Wenger \n" "Language-Team: Deutsch <>\n" "Language: de\n" @@ -17,41 +17,45 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: src/guiMainMenu.cpp:173 +#: src/guiMainMenu.cpp:180 msgid "Name/Password" msgstr "Name/Passwort" -#: src/guiMainMenu.cpp:195 +#: src/guiMainMenu.cpp:202 msgid "Address/Port" msgstr "Adresse / Port" -#: src/guiMainMenu.cpp:214 +#: src/guiMainMenu.cpp:220 msgid "Leave address blank to start a local server." msgstr "Lasse die Adresse frei um einen eigenen Server zu starten" -#: src/guiMainMenu.cpp:220 +#: src/guiMainMenu.cpp:226 msgid "Fancy trees" msgstr "Schöne Bäume" -#: src/guiMainMenu.cpp:226 +#: src/guiMainMenu.cpp:232 msgid "Smooth Lighting" msgstr "Besseres Licht" -#: src/guiMainMenu.cpp:233 +#: src/guiMainMenu.cpp:239 msgid "Start Game / Connect" msgstr "Spiel starten / Verbinden" -#: src/guiMainMenu.cpp:256 +#: src/guiMainMenu.cpp:247 +msgid "Change keys" +msgstr "Tastenbelegung ändern" + +#: src/guiMainMenu.cpp:269 msgid "Creative Mode" msgstr "Kreativitätsmodus" -#: src/guiMainMenu.cpp:261 +#: src/guiMainMenu.cpp:274 msgid "Enable Damage" msgstr "Schaden einschalten" -#: src/guiMainMenu.cpp:268 -msgid "Delete world" -msgstr "Welt löschen" +#: src/guiMainMenu.cpp:281 +msgid "Delete map" +msgstr "Karte löschen" #: src/guiMessageMenu.cpp:92 #: src/guiTextInputMenu.cpp:110 diff --git a/updatelocales.sh b/updatelocales.sh old mode 100644 new mode 100755 From 3321edae77184ae9693e3b74c9ea6235ec1f9029 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 19 Jul 2011 20:02:31 +0200 Subject: [PATCH 070/107] Use system sqlite3/jthread libs if available --- cmake/Modules/FindJthread.cmake | 18 ++++++++++++++++++ cmake/Modules/FindSqlite3.cmake | 18 ++++++++++++++++++ src/CMakeLists.txt | 23 ++++++++++++++++------- 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 cmake/Modules/FindJthread.cmake create mode 100644 cmake/Modules/FindSqlite3.cmake diff --git a/cmake/Modules/FindJthread.cmake b/cmake/Modules/FindJthread.cmake new file mode 100644 index 000000000..302a3c22f --- /dev/null +++ b/cmake/Modules/FindJthread.cmake @@ -0,0 +1,18 @@ +# Look for jthread, use our own if not found + +FIND_PATH(JTHREAD_INCLUDE_DIR jthread.h) + +FIND_LIBRARY(JTHREAD_LIBRARY NAMES jthread) + +IF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR) + SET( JTHREAD_FOUND TRUE ) +ENDIF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR) + +IF(JTHREAD_FOUND) + MESSAGE(STATUS "Found system jthread header file in ${JTHREAD_INCLUDE_DIR}") + MESSAGE(STATUS "Found system jthread library ${JTHREAD_LIBRARY}") +ELSE(JTHREAD_FOUND) + SET(JTHREAD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jthread) + SET(JTHREAD_LIBRARY jthread) + MESSAGE(STATUS "Using project jthread library") +ENDIF(JTHREAD_FOUND) diff --git a/cmake/Modules/FindSqlite3.cmake b/cmake/Modules/FindSqlite3.cmake new file mode 100644 index 000000000..ecce6e38e --- /dev/null +++ b/cmake/Modules/FindSqlite3.cmake @@ -0,0 +1,18 @@ +# Look for sqlite3, use our own if not found + +FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h) + +FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3) + +IF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR) + SET( SQLITE3_FOUND TRUE ) +ENDIF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR) + +IF(SQLITE3_FOUND) + MESSAGE(STATUS "Found system sqlite3 header file in ${SQLITE3_INCLUDE_DIR}") + MESSAGE(STATUS "Found system sqlite3 library ${SQLITE3_LIBRARY}") +ELSE(SQLITE3_FOUND) + SET(SQLITE3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/sqlite) + SET(SQLITE3_LIBRARY sqlite3) + MESSAGE(STATUS "Using project sqlite3 library") +ENDIF(SQLITE3_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fd1591423..e1de23663 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,8 @@ else() find_package(JPEG REQUIRED) find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) + find_package(Jthread REQUIRED) + find_package(Sqlite3 REQUIRED) if(APPLE) FIND_LIBRARY(CARBON_LIB Carbon) FIND_LIBRARY(COCOA_LIB Cocoa) @@ -143,8 +145,8 @@ include_directories( ${CMAKE_BUILD_TYPE} ${PNG_INCLUDE_DIR} ${GETTEXT_INCLUDE_DIR} - "${PROJECT_SOURCE_DIR}/jthread" - "${PROJECT_SOURCE_DIR}/sqlite" + ${JTHREAD_INCLUDE_DIR} + ${SQLITE3_INCLUDE_DIR} ) set(EXECUTABLE_OUTPUT_PATH ../bin) @@ -163,8 +165,8 @@ if(BUILD_CLIENT) ${GETTEXT_LIBRARIES} ${PLATFORM_LIBS} ${CLIENT_PLATFORM_LIBS} - jthread - sqlite3 + ${JTHREAD_LIBRARY} + ${SQLITE3_LIBRARY} ) endif(BUILD_CLIENT) @@ -174,8 +176,8 @@ if(BUILD_SERVER) minetestserver ${ZLIB_LIBRARIES} ${PLATFORM_LIBS} - jthread - sqlite3 + ${JTHREAD_LIBRARY} + ${SQLITE3_LIBRARY} ) endif(BUILD_SERVER) @@ -296,7 +298,14 @@ add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BI # Subdirectories -add_subdirectory(jthread) +if (JTHREAD_FOUND) +else (JTHREAD_FOUND) + add_subdirectory(jthread) +endif (JTHREAD_FOUND) + +if (SQLITE3_FOUND) +else (SQLITE3_FOUND) add_subdirectory(sqlite) +endif (SQLITE3_FOUND) #end From 8fa94c3547dc7bd25e9bb7f0c404a00028a1107d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 8 Jun 2011 17:27:30 +0200 Subject: [PATCH 071/107] Check the data path before usage When not running in place, check if the assumed data path in ../share/APPNAME exists. If it doesn't exist, fall back to ../data instead. This allows the program to run successfully from the checkout directory even without the run-in-place flag active. --- src/porting.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/porting.cpp b/src/porting.cpp index 7de042ab5..ff8cb3862 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include "config.h" #include "debug.h" +#include "filesys.h" #ifdef __APPLE__ #include "CoreFoundation/CoreFoundation.h" @@ -210,6 +211,11 @@ void initializePaths() path_data = std::string(buf) + "/../share/" + APPNAME; //path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME; + if (!fs::PathExists(path_data)) { + dstream<<"WARNING: data path " << path_data << " not found!"; + path_data = std::string(buf) + "/../data"; + dstream<<" Trying " << path_data << std::endl; + } path_userdata = std::string(getenv("HOME")) + "/." + APPNAME; From 52df1b598c253eda7b9e33cf9b7e97d16c7dc138 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 9 Jun 2011 22:31:40 +0200 Subject: [PATCH 072/107] Set the window caption for the initial window too --- src/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 1cc479d65..7d0ea12ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1350,6 +1350,9 @@ int main(int argc, char *argv[]) // Set device in game parameters device = device; + + // Set the window caption + device->setWindowCaption(L"Minetest [Main Menu]"); // Create time getter g_timegetter = new IrrlichtTimeGetter(device); From c6d99fbe0c42b86585263a2562db671d9c168581 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Wed, 20 Jul 2011 18:49:18 +0200 Subject: [PATCH 073/107] fixed problem with wront paths in gettext --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1cc479d65..00248a203 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1060,10 +1060,6 @@ int main(int argc, char *argv[]) std::locale::global(std::locale("C")); // This enables printing all characters in bitmap font setlocale(LC_CTYPE, "en_US"); - setlocale(LC_ALL, ""); - bindtextdomain("minetest-c55", "./../locale"); - textdomain("minetest-c55"); - /* Parse command line */ @@ -1135,6 +1131,10 @@ int main(int argc, char *argv[]) // Create user data directory fs::CreateDir(porting::path_userdata); + + setlocale(LC_ALL, ""); + bindtextdomain("minetest-c55", (porting::path_userdata+"/locale").c_str()); + textdomain("minetest-c55"); // Initialize debug streams #ifdef RUN_IN_PLACE From 4cbdf136fc70016f2721db311bda5ade7a3cdab8 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 20 Jul 2011 19:14:40 +0200 Subject: [PATCH 074/107] * README updated --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 65a288161..e03bdae25 100644 --- a/README +++ b/README @@ -5,6 +5,8 @@ New features: * configurable far mesh tree display (boolean) * configurable far mesh rendering distance * volumetric clouds (using fake shading) +* translation support (including questionable translation into german) +* build system uses local jthread & sqlite libraries if available New bricks: * Sandstone (crafted from 4 sand, yields sand) From 8129d16dd3f7e5575c444b4792e667a1e3df98e2 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 20 Jul 2011 22:04:24 +0200 Subject: [PATCH 075/107] + fireflies --- data/firefly.png | Bin 0 -> 150 bytes src/content_cao.cpp | 157 ++++++++++++++++++++++++++++++++++ src/content_cao.h | 42 +++++++++ src/content_inventory.cpp | 9 +- src/content_object.h | 1 + src/content_sao.cpp | 175 ++++++++++++++++++++++++++++++++++++++ src/content_sao.h | 24 ++++++ src/environment.cpp | 3 +- 8 files changed, 409 insertions(+), 2 deletions(-) create mode 100644 data/firefly.png diff --git a/data/firefly.png b/data/firefly.png new file mode 100644 index 0000000000000000000000000000000000000000..d5a444b039f45e3bc76e692ed15b258357aa3047 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|0z6$DLnJOI z>&&XZH>0t!aiRXj4?4_34V}i0KW7;*rg*Xef!d05uX%tVf4#w<`s&t)_C7*KuWS#O t`1il^<^TWZz3W9>eR!5IlxVMDX6SgU#+aC8egSAUgQu&X%Q~loCIFMSF>n9? literal 0 HcmV?d00001 diff --git a/src/content_cao.cpp b/src/content_cao.cpp index dc5ac400f..dfeaea85a 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -752,4 +752,161 @@ void Oerkki1CAO::initialize(const std::string &data) updateNodePos(); } +/* + FireflyCAO +*/ +// Prototype +FireflyCAO proto_FireflyCAO; + +FireflyCAO::FireflyCAO(): + ClientActiveObject(0), + m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS/2.,BS/3.), + m_node(NULL), + m_position(v3f(0,10*BS,0)), + m_yaw(0) +{ + ClientActiveObject::registerType(getType(), create); +} + +FireflyCAO::~FireflyCAO() +{ +} + +ClientActiveObject* FireflyCAO::create() +{ + return new FireflyCAO(); +} + +void FireflyCAO::addToScene(scene::ISceneManager *smgr) +{ + if(m_node != NULL) + return; + + video::IVideoDriver* driver = smgr->getVideoDriver(); + + scene::SMesh *mesh = new scene::SMesh(); + scene::IMeshBuffer *buf = new scene::SMeshBuffer(); + video::SColor c(255,255,255,255); + video::S3DVertex vertices[4] = + { + video::S3DVertex(0,0,0, 0,0,0, c, 0,1), + video::S3DVertex(BS/2,0,0, 0,0,0, c, 1,1), + video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, 1,0), + video::S3DVertex(0,BS/2,0, 0,0,0, c, 0,0), + }; + u16 indices[] = {0,1,2,2,3,0}; + buf->append(vertices, 4, indices, 6); + // Set material + buf->getMaterial().setFlag(video::EMF_LIGHTING, false); + buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false); + //buf->getMaterial().setTexture(0, NULL); + buf->getMaterial().setTexture + (0, driver->getTexture(getTexturePath("firefly.png").c_str())); + buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false); + buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true); + buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; + // Add to mesh + mesh->addMeshBuffer(buf); + buf->drop(); + m_node = smgr->addMeshSceneNode(mesh, NULL); + mesh->drop(); + // Set it to use the materials of the meshbuffers directly. + // This is needed for changing the texture in the future + m_node->setReadOnlyMaterials(true); + updateNodePos(); +} + +void FireflyCAO::removeFromScene() +{ + if(m_node == NULL) + return; + + m_node->remove(); + m_node = NULL; +} + +void FireflyCAO::updateLight(u8 light_at_pos) +{ + if(m_node == NULL) + return; + + u8 li = 255; + video::SColor color(255,li,li,li); + + scene::IMesh *mesh = m_node->getMesh(); + if(mesh == NULL) + return; + + u16 mc = mesh->getMeshBufferCount(); + for(u16 j=0; jgetMeshBuffer(j); + video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); + u16 vc = buf->getVertexCount(); + for(u16 i=0; isetPosition(m_position); + m_node->setPosition(pos_translator.vect_show); + + v3f rot = m_node->getRotation(); + rot.Y = 180.0 - m_yaw; + m_node->setRotation(rot); +} + +void FireflyCAO::step(float dtime, ClientEnvironment *env) +{ + pos_translator.translate(dtime); + updateNodePos(); +} + +void FireflyCAO::processMessage(const std::string &data) +{ + //dstream<<"FireflyCAO: Got message"<* getSelectionBox() + {return &m_selection_box;} + v3f getPosition() + {return m_position;} + +private: + core::aabbox3d m_selection_box; + scene::IMeshSceneNode *m_node; + v3f m_position; + float m_yaw; + SmoothTranslator pos_translator; +}; + #endif diff --git a/src/content_inventory.cpp b/src/content_inventory.cpp index 7d995cb5f..1068defb5 100644 --- a/src/content_inventory.cpp +++ b/src/content_inventory.cpp @@ -65,6 +65,8 @@ std::string item_craft_get_image_name(const std::string &subname) return "clay_brick.png"; else if(subname == "rat") return "rat.png"; + else if(subname == "firefly") + return "firefly.png"; else return "cloud.png"; // just something } @@ -77,13 +79,18 @@ ServerActiveObject* item_craft_create_object(const std::string &subname, ServerActiveObject *obj = new RatSAO(env, id, pos); return obj; } + else if(subname == "firefly") + { + ServerActiveObject *obj = new FireflySAO(env, id, pos); + return obj; + } return NULL; } s16 item_craft_get_drop_count(const std::string &subname) { - if(subname == "rat") + if(subname == "rat" || subname == "firefly") return 1; return -1; diff --git a/src/content_object.h b/src/content_object.h index ecabd8a38..47f93d7d4 100644 --- a/src/content_object.h +++ b/src/content_object.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define ACTIVEOBJECT_TYPE_ITEM 2 #define ACTIVEOBJECT_TYPE_RAT 3 #define ACTIVEOBJECT_TYPE_OERKKI1 4 +#define ACTIVEOBJECT_TYPE_FIREFLY 5 #endif diff --git a/src/content_sao.cpp b/src/content_sao.cpp index c41f4ed78..aeeafc2f8 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -693,4 +693,179 @@ void Oerkki1SAO::doDamage(u16 d) } } +/* + FireflySAO +*/ +// Prototype +FireflySAO proto_FireflySAO(NULL, 0, v3f(0,0,0)); + +FireflySAO::FireflySAO(ServerEnvironment *env, u16 id, v3f pos): + ServerActiveObject(env, id, pos), + m_is_active(false), + m_speed_f(0,0,0) +{ + ServerActiveObject::registerType(getType(), create); + + m_oldpos = v3f(0,0,0); + m_last_sent_position = v3f(0,0,0); + m_yaw = 0; + m_counter1 = 0; + m_counter2 = 0; + m_age = 0; + m_touching_ground = false; +} + +ServerActiveObject* FireflySAO::create(ServerEnvironment *env, u16 id, v3f pos, + const std::string &data) +{ + std::istringstream is(data, std::ios::binary); + char buf[1]; + // read version + is.read(buf, 1); + u8 version = buf[0]; + // check if version is supported + if(version != 0) + return NULL; + return new FireflySAO(env, id, pos); +} + +void FireflySAO::step(float dtime, bool send_recommended) +{ + assert(m_env); + + if(m_is_active == false) + { + if(m_inactive_interval.step(dtime, 0.5)==false) + return; + } + + /* + The AI + */ + + // Apply (less) gravity + m_speed_f.Y -= dtime*3*BS; + + /* + Move around if some player is close + */ + bool player_is_close = false; + // Check connected players + core::list players = m_env->getPlayers(true); + core::list::Iterator i; + for(i = players.begin(); + i != players.end(); i++) + { + Player *player = *i; + v3f playerpos = player->getPosition(); + if(m_base_position.getDistanceFrom(playerpos) < BS*10.0) + { + player_is_close = true; + break; + } + } + + m_is_active = player_is_close; + + if(player_is_close == false) + { + m_speed_f.X = 0; + m_speed_f.Z = 0; + } + else + { + // Move around + v3f dir(cos(m_yaw/180*PI),0,sin(m_yaw/180*PI)); + f32 speed = BS/2; + m_speed_f.X = speed * dir.X; + m_speed_f.Z = speed * dir.Z; + + if(m_touching_ground && (m_oldpos - m_base_position).getLength() + < dtime*speed/2) + { + m_counter1 -= dtime; + if(m_counter1 < 0.0) + { + m_counter1 += 1.0; + m_speed_f.Y = 5.0*BS; + } + } + + { + m_counter2 -= dtime; + if(m_counter2 < 0.0) + { + m_counter2 += (float)(myrand()%100)/100*3.0; + m_yaw += ((float)(myrand()%200)-100)/100*180; + m_yaw = wrapDegrees(m_yaw); + } + } + } + + m_oldpos = m_base_position; + + /* + Move it, with collision detection + */ + + core::aabbox3d box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.); + collisionMoveResult moveresult; + // Maximum movement without glitches + f32 pos_max_d = BS*0.25; + // Limit speed + if(m_speed_f.getLength()*dtime > pos_max_d) + m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime); + v3f pos_f = getBasePosition(); + v3f pos_f_old = pos_f; + moveresult = collisionMoveSimple(&m_env->getMap(), pos_max_d, + box, dtime, pos_f, m_speed_f); + m_touching_ground = moveresult.touching_ground; + + setBasePosition(pos_f); + + if(send_recommended == false) + return; + + if(pos_f.getDistanceFrom(m_last_sent_position) > 0.05*BS) + { + m_last_sent_position = pos_f; + + std::ostringstream os(std::ios::binary); + // command (0 = update position) + writeU8(os, 0); + // pos + writeV3F1000(os, m_base_position); + // yaw + writeF1000(os, m_yaw); + // create message and add to list + ActiveObjectMessage aom(getId(), false, os.str()); + m_messages_out.push_back(aom); + } +} + +std::string FireflySAO::getClientInitializationData() +{ + std::ostringstream os(std::ios::binary); + // version + writeU8(os, 0); + // pos + writeV3F1000(os, m_base_position); + return os.str(); +} + +std::string FireflySAO::getStaticData() +{ + //dstream<<__FUNCTION_NAME< Date: Wed, 20 Jul 2011 22:49:48 +0200 Subject: [PATCH 076/107] Move package search out of conditional This unbreaks the Windows build which would otherwise have problems at the jthread level. --- src/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1de23663..72f79976c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,8 +43,6 @@ else() find_package(JPEG REQUIRED) find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) - find_package(Jthread REQUIRED) - find_package(Sqlite3 REQUIRED) if(APPLE) FIND_LIBRARY(CARBON_LIB Carbon) FIND_LIBRARY(COCOA_LIB Cocoa) @@ -65,6 +63,9 @@ else() set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY}) endif() +find_package(Jthread REQUIRED) +find_package(Sqlite3 REQUIRED) + configure_file( "${PROJECT_SOURCE_DIR}/cmake_config.h.in" "${PROJECT_BINARY_DIR}/cmake_config.h" From 9cb5f70be56dbbbb75bb12de23f05243d2173030 Mon Sep 17 00:00:00 2001 From: Weedy Date: Thu, 21 Jul 2011 02:30:21 -0400 Subject: [PATCH 077/107] Fix win32 MSVC compile. (screw gettext) --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72f79976c..a578eeb79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,8 +31,8 @@ if(WIN32) CACHE PATH "gettext include directory") set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin" CACHE PATH "gettext bin directory") - set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/intl.lib" - CACHE FILEPATH "gettext intl.lib") + set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/libintl.lib" + CACHE FILEPATH "gettext libintl.lib") set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2" CACHE PATH "irrlicht dir") else() @@ -277,7 +277,7 @@ if(BUILD_SERVER) endif(BUILD_SERVER) if(WIN32) - set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") + set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt.exe" CACHE FILEPATH "path to msgfmt") elseif(APPLE) set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") else() From 36d8f91f1acfaec345c44fc5518b3acbcafad695 Mon Sep 17 00:00:00 2001 From: Weedy Date: Thu, 21 Jul 2011 02:36:30 -0400 Subject: [PATCH 078/107] Tweak makefiles to add -delta suffix. --- CMakeLists.txt | 16 ++++++++-------- makepackage_binary.sh | 10 +++++++--- src/CMakeLists.txt | 26 +++++++++++++------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15f4a6453..aae390f38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ if(${CMAKE_VERSION} STREQUAL "2.8.2") endif(${CMAKE_VERSION} STREQUAL "2.8.2") # This can be read from ${PROJECT_NAME} after project() is called -project(minetest) +project(minetest-delta) set(VERSION_MAJOR 0) set(VERSION_MINOR 2) -set(VERSION_PATCH 20110704_0) +set(VERSION_PATCH 20110720_0) set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") # Configuration options @@ -48,15 +48,15 @@ if(WIN32) set(EXAMPLE_CONF_DIR ".") elseif(APPLE) # random placeholders - set(DATADIR "share/minetest") + set(DATADIR "share/${PROJECT_NAME}") set(BINDIR "bin") - set(DOCDIR "share/doc/minetest") + set(DOCDIR "share/doc/${PROJECT_NAME}") set(EXAMPLE_CONF_DIR ".") elseif(UNIX) # Linux, BSD etc - set(DATADIR "share/minetest") + set(DATADIR "share/${PROJECT_NAME}") set(BINDIR "bin") - set(DOCDIR "share/doc/minetest") - set(EXAMPLE_CONF_DIR "share/doc/minetest") + set(DOCDIR "share/doc/${PROJECT_NAME}") + set(EXAMPLE_CONF_DIR "share/doc/${PROJECT_NAME}") endif() install(FILES "doc/README.txt" DESTINATION "${DOCDIR}") @@ -103,7 +103,7 @@ elseif(APPLE) set(CPACK_BUNDLE_NAME ${PROJECT_NAME}) set(CPACK_BUNDLE_ICON "") set(CPACK_BUNDLE_PLIST "") - set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest") + set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/${PROJECT_NAME}") set(CPACK_GENERATOR "Bundle") else() set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux") diff --git a/makepackage_binary.sh b/makepackage_binary.sh index f00ec608c..32d19865a 100755 --- a/makepackage_binary.sh +++ b/makepackage_binary.sh @@ -1,17 +1,19 @@ #!/bin/sh -PACKAGEDIR=../minetest-packages -PACKAGENAME=minetest-c55-binary-`date +%y%m%d%H%M%S` +PROJECT_NAME=minetest-delta +PACKAGEDIR=../$PROJECT_NAME-packages +PACKAGENAME=$PROJECT_NAME-binary-`date +%y%m%d%H%M%S` PACKAGEPATH=$PACKAGEDIR/$PACKAGENAME mkdir -p $PACKAGEPATH mkdir -p $PACKAGEPATH/bin mkdir -p $PACKAGEPATH/data mkdir -p $PACKAGEPATH/doc +mkdir -p $PACKAGEPATH/locale/de/LC_MESSAGES/ cp minetest.conf.example $PACKAGEPATH/ -cp bin/minetest.exe $PACKAGEPATH/bin/ +cp bin/$PROJECT_NAME.exe $PACKAGEPATH/bin/ cp bin/Irrlicht.dll $PACKAGEPATH/bin/ cp bin/zlibwapi.dll $PACKAGEPATH/bin/ #cp bin/test $PACKAGEPATH/bin/ @@ -57,6 +59,8 @@ cp -r data/sand.png $PACKAGEPATH/data/ cp -r doc/README.txt $PACKAGEPATH/doc/README.txt +cp -r locale/de/LC_MESSAGES/$PROJECT_NAME.mo $PACKAGEPATH/locale/de/LC_MESSAGES/ + cd $PACKAGEDIR rm $PACKAGENAME.zip zip -r $PACKAGENAME.zip $PACKAGENAME diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a578eeb79..2e99ec0c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -project(minetest) +project(minetest-delta) cmake_minimum_required( VERSION 2.6 ) if(RUN_IN_PLACE) @@ -153,9 +153,9 @@ include_directories( set(EXECUTABLE_OUTPUT_PATH ../bin) if(BUILD_CLIENT) - add_executable(minetest ${minetest_SRCS}) + add_executable(${PROJECT_NAME} ${minetest_SRCS}) target_link_libraries( - minetest + ${PROJECT_NAME} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${OPENGL_LIBRARIES} @@ -172,9 +172,9 @@ if(BUILD_CLIENT) endif(BUILD_CLIENT) if(BUILD_SERVER) - add_executable(minetestserver ${minetestserver_SRCS}) + add_executable(${PROJECT_NAME}server ${minetestserver_SRCS}) target_link_libraries( - minetestserver + ${PROJECT_NAME}server ${ZLIB_LIBRARIES} ${PLATFORM_LIBS} ${JTHREAD_LIBRARY} @@ -199,7 +199,7 @@ if(MSVC) set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1") if(BUILD_SERVER) - set_target_properties(minetestserver PROPERTIES + set_target_properties(${PROJECT_NAME}server PROPERTIES COMPILE_DEFINITIONS "SERVER") endif(BUILD_SERVER) @@ -233,7 +233,7 @@ else() endif() if(BUILD_SERVER) - set_target_properties(minetestserver PROPERTIES + set_target_properties(${PROJECT_NAME}server PROPERTIES COMPILE_DEFINITIONS "SERVER") endif(BUILD_SERVER) @@ -250,13 +250,13 @@ endif() install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../minetest.conf.example" DESTINATION ${EXAMPLE_CONF_DIR}) if(BUILD_CLIENT) - install(TARGETS minetest DESTINATION ${BINDIR}) + install(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) file(GLOB images "${CMAKE_CURRENT_SOURCE_DIR}/../data/*.png") install(FILES ${images} DESTINATION ${DATADIR}) - install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo DESTINATION locale/de/LC_MESSAGES) + install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo DESTINATION locale/de/LC_MESSAGES) if(WIN32) if(DEFINED IRRLICHT_DLL) @@ -273,7 +273,7 @@ if(BUILD_CLIENT) endif(BUILD_CLIENT) if(BUILD_SERVER) - install(TARGETS minetestserver DESTINATION ${BINDIR}) + install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR}) endif(BUILD_SERVER) if(WIN32) @@ -287,15 +287,15 @@ endif() add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo - COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po + OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo + COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de COMMENT "mo-update [de]: Creating mo file." ) -add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo) +add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo) # Subdirectories From fd70bbd36785c27fa8ef8229eee79fac32557e42 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 07:53:13 +0200 Subject: [PATCH 079/107] Make gettext optional --- src/CMakeLists.txt | 66 ++++++++++++++++++++++++++++------------------ src/gettext.h | 9 ++++++- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e99ec0c9..fb8f419e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,16 @@ if(RUN_IN_PLACE) add_definitions ( -DRUN_IN_PLACE ) endif(RUN_IN_PLACE) +if(USE_GETTEXT) + add_definitions( -DUSE_GETTEXT ) + message(STATUS "GetText enabled") +else() + set(GETTEXT_INCLUDE_DIR "") + set(GETTEXT_BIN_DIR "") + set(GETTEXT_LIBRARIES "") + message(STATUS "GetText disabled") +endif(USE_GETTEXT) + if(NOT MSVC) set(USE_GPROF 0 CACHE BOOL "Use -pg flag for g++") endif() @@ -27,14 +37,16 @@ if(WIN32) CACHE FILEPATH "Path to zlibwapi.lib") set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll" CACHE FILEPATH "Path to zlibwapi.dll (for installation)") - set(GETTEXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../gettext/include" - CACHE PATH "gettext include directory") - set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin" - CACHE PATH "gettext bin directory") - set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/libintl.lib" - CACHE FILEPATH "gettext libintl.lib") set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2" CACHE PATH "irrlicht dir") + if (USE_GETTEXT) + set(GETTEXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../gettext/include" + CACHE PATH "gettext include directory") + set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin" + CACHE PATH "gettext bin directory") + set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/libintl.lib" + CACHE FILEPATH "gettext libintl.lib") + endif(USE_GETTEXT) else() # Unix probably if(BUILD_CLIENT) @@ -221,7 +233,7 @@ else() set(ARCH i386) endif() - if(WIN32) + if(WIN32 AND USE_GETTEXT) set(CMAKE_EXE_LINKER_FLAGS "-lintl -L ${GETTEXT_BIN_DIR}") endif() @@ -265,7 +277,7 @@ if(BUILD_CLIENT) if(DEFINED ZLIB_DLL) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) endif() - if(DEFINED GETTEXT_BIN_DIR) + if(USE_GETTEXT AND DEFINED GETTEXT_BIN_DIR) install(FILES ${GETTEXT_BIN_DIR}/libintl3.dll DESTINATION ${BINDIR}) install(FILES ${GETTEXT_BIN_DIR}/libiconv2.dll DESTINATION ${BINDIR}) endif() @@ -276,26 +288,28 @@ if(BUILD_SERVER) install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR}) endif(BUILD_SERVER) -if(WIN32) - set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt.exe" CACHE FILEPATH "path to msgfmt") -elseif(APPLE) - set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") -else() - set(GETTEXT_MSGFMT "msgfmt") -endif() +if (USE_GETTEXT) + if(WIN32) + set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt.exe" CACHE FILEPATH "path to msgfmt") + elseif(APPLE) + set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") + else() + set(GETTEXT_MSGFMT "msgfmt") + endif() -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") -add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo - COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po - DEPENDS - ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES - ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de - COMMENT "mo-update [de]: Creating mo file." - ) -add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo + COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po + DEPENDS + ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES + ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de + COMMENT "mo-update [de]: Creating mo file." + ) + add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo) +endif(USE_GETTEXT) # Subdirectories diff --git a/src/gettext.h b/src/gettext.h index 7f5f56e49..8ddb95346 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -1,9 +1,16 @@ +#ifdef USE_GETTEXT #include +#else +#define gettext(String) String +#define bindtextdomain(domain, dir) /* */ +#define textdomain(domain) /* */ +#endif + #define _(String) gettext(String) #define gettext_noop(String) String #define N_(String) gettext_noop (String) -inline wchar_t* chartowchar_t(char *str) +inline wchar_t* chartowchar_t(const char *str) { size_t l = strlen(str)+1; wchar_t* nstr = new wchar_t[l]; From b99174cb0c680396373c0190d4c04afa7e28028f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 12:33:29 +0200 Subject: [PATCH 080/107] Refactor and clean up gettext management --- cmake/Modules/FindGettextLib.cmake | 48 ++++++++++++++++++++++++++ src/CMakeLists.txt | 54 ++++++++++++++---------------- 2 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 cmake/Modules/FindGettextLib.cmake diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake new file mode 100644 index 000000000..1ef8997f4 --- /dev/null +++ b/cmake/Modules/FindGettextLib.cmake @@ -0,0 +1,48 @@ +# Package finder for gettext libs and include files + +SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext" + CACHE FILEPATH "path to custom gettext") + +# by default +SET(GETTEXT_FOUND FALSE) + +FIND_PATH(GETTEXT_INCLUDE_DIR + NAMES libintl.h + PATHS "${CUSTOM_GETTEXT_PATH}/include" + DOC "gettext include directory") + +FIND_PROGRAM(GETTEXT_MSGFMT + NAMES msgfmt + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgfmt") + +# modern Linux, as well as Mac, seem to not need require special linking +# TODO check the requirements on other BSDs and older Linux +IF (WIN32) + FIND_LIBRARY(GETTEXT_LIBRARY + NAMES libintl.lib intl.lib libintl3.lib intl3.lib + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *intl*.lib") + FIND_LIBRARY(GETTEXT_DLL + NAMES libintl.dll intl.dll libintl3.dll intl3.dll + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *intl*.dll") + FIND_LIBRARY(GETTEXT_ICONV_DLL + NAMES libiconv2.dll + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *iconv*.lib") +ENDIF(WIN32) + + +IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT) + IF (WIN32) + # in the Win32 case check also for the extra linking requirements + IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL) + SET(GETTEXT_FOUND TRUE) + ENDIF() + ELSE(WIN32) + SET(GETTEXT_FOUND TRUE) + ENDIF(WIN32) +ENDIF() + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb8f419e5..8785a0e3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,12 +6,22 @@ if(RUN_IN_PLACE) endif(RUN_IN_PLACE) if(USE_GETTEXT) - add_definitions( -DUSE_GETTEXT ) - message(STATUS "GetText enabled") -else() - set(GETTEXT_INCLUDE_DIR "") - set(GETTEXT_BIN_DIR "") - set(GETTEXT_LIBRARIES "") + find_package(GettextLib REQUIRED) + if (GETTEXT_FOUND) + add_definitions( -DUSE_GETTEXT ) + message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}") + message(STATUS "gettext msgfmt path: ${GETTEXT_MSGFMT}") + if(WIN32) + message(STATUS "gettext library: ${GETTEXT_LIBRARY}") + message(STATUS "gettext dll: ${GETTEXT_DLL}") + message(STATUS "gettext iconv dll: ${GETTEXT_ICONV_DLL}") + endif() + message(STATUS "GetText enabled") + else() + message(ERROR "GetText enabled but not found, disabling") + set(USE_GETTEXT FALSE) + endif(GETTEXT_FOUND) +else(USE_GETTEXT) message(STATUS "GetText disabled") endif(USE_GETTEXT) @@ -39,14 +49,6 @@ if(WIN32) CACHE FILEPATH "Path to zlibwapi.dll (for installation)") set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2" CACHE PATH "irrlicht dir") - if (USE_GETTEXT) - set(GETTEXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../gettext/include" - CACHE PATH "gettext include directory") - set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin" - CACHE PATH "gettext bin directory") - set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/libintl.lib" - CACHE FILEPATH "gettext libintl.lib") - endif(USE_GETTEXT) else() # Unix probably if(BUILD_CLIENT) @@ -175,7 +177,7 @@ if(BUILD_CLIENT) ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${X11_LIBRARIES} - ${GETTEXT_LIBRARIES} + ${GETTEXT_LIBRARY} ${PLATFORM_LIBS} ${CLIENT_PLATFORM_LIBS} ${JTHREAD_LIBRARY} @@ -234,7 +236,7 @@ else() endif() if(WIN32 AND USE_GETTEXT) - set(CMAKE_EXE_LINKER_FLAGS "-lintl -L ${GETTEXT_BIN_DIR}") + set(CMAKE_EXE_LINKER_FLAGS "-l${GETTEXT_LIBRARY}") endif() set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops") @@ -277,10 +279,14 @@ if(BUILD_CLIENT) if(DEFINED ZLIB_DLL) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) endif() - if(USE_GETTEXT AND DEFINED GETTEXT_BIN_DIR) - install(FILES ${GETTEXT_BIN_DIR}/libintl3.dll DESTINATION ${BINDIR}) - install(FILES ${GETTEXT_BIN_DIR}/libiconv2.dll DESTINATION ${BINDIR}) - endif() + if(USE_GETTEXT) + if(defined GETTEXT_DLL) + install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR}) + endif() + if(defined GETTEXT_ICONV_DLL) + install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR}) + endif() + endif(USE_GETTEXT) endif() endif(BUILD_CLIENT) @@ -289,14 +295,6 @@ if(BUILD_SERVER) endif(BUILD_SERVER) if (USE_GETTEXT) - if(WIN32) - set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt.exe" CACHE FILEPATH "path to msgfmt") - elseif(APPLE) - set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt") - else() - set(GETTEXT_MSGFMT "msgfmt") - endif() - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") add_custom_command( From ad2f95fc700f1625bf1ac30e5de3ff8b8b7180ba Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Thu, 21 Jul 2011 13:24:37 +0200 Subject: [PATCH 081/107] updated some path because the dlls are mostly under bin not lib added explanation why libintl must not belinked under some oses --- cmake/Modules/FindGettextLib.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 1ef8997f4..3fb391e65 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -17,6 +17,7 @@ FIND_PROGRAM(GETTEXT_MSGFMT DOC "path to msgfmt") # modern Linux, as well as Mac, seem to not need require special linking +# they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux IF (WIN32) FIND_LIBRARY(GETTEXT_LIBRARY @@ -25,11 +26,11 @@ IF (WIN32) DOC "gettext *intl*.lib") FIND_LIBRARY(GETTEXT_DLL NAMES libintl.dll intl.dll libintl3.dll intl3.dll - PATHS "${CUSTOM_GETTEXT_PATH}/lib" + PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.dll") FIND_LIBRARY(GETTEXT_ICONV_DLL NAMES libiconv2.dll - PATHS "${CUSTOM_GETTEXT_PATH}/lib" + PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *iconv*.lib") ENDIF(WIN32) From adb7181969a6398762873298ef0b50ca575d7b31 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 13:59:50 +0200 Subject: [PATCH 082/107] Uppercase DEFINED or cmake 2.8.4 complains --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8785a0e3f..2d7a7fc68 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -280,10 +280,10 @@ if(BUILD_CLIENT) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) endif() if(USE_GETTEXT) - if(defined GETTEXT_DLL) + if(DEFINED GETTEXT_DLL) install(FILES ${GETTEXT_DLL} DESTINATION ${BINDIR}) endif() - if(defined GETTEXT_ICONV_DLL) + if(DEFINED GETTEXT_ICONV_DLL) install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR}) endif() endif(USE_GETTEXT) From 7b93fb59cfbc9d89e13b8046634c0ab5a1a4a691 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 14:46:14 +0200 Subject: [PATCH 083/107] Only install locale files if using gettext --- src/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d7a7fc68..6cc5c035f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -270,8 +270,10 @@ if(BUILD_CLIENT) install(FILES ${images} DESTINATION ${DATADIR}) - install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo DESTINATION locale/de/LC_MESSAGES) - + if (USE_GETTEXT) + install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo DESTINATION locale/de/LC_MESSAGES) + endif() + if(WIN32) if(DEFINED IRRLICHT_DLL) install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) From 02695bebc632042dd684991665b93925b974d7d4 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 14:50:15 +0200 Subject: [PATCH 084/107] Find correct library for MSVC vs MingW in Winows --- cmake/Modules/FindGettextLib.cmake | 9 ++++++++- src/CMakeLists.txt | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 3fb391e65..1bc92708a 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -20,8 +20,15 @@ FIND_PROGRAM(GETTEXT_MSGFMT # they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux IF (WIN32) + IF(MSVC) + SET(GETTEXT_LIB_NAMES + libintl.lib intl.lib libintl3.lib intl3.lib) + ELSE() + SET(GETTEXT_LIB_NAMES + libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a) + ENDIF() FIND_LIBRARY(GETTEXT_LIBRARY - NAMES libintl.lib intl.lib libintl3.lib intl3.lib + NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.lib") FIND_LIBRARY(GETTEXT_DLL diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6cc5c035f..c018d8e56 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -235,10 +235,6 @@ else() set(ARCH i386) endif() - if(WIN32 AND USE_GETTEXT) - set(CMAKE_EXE_LINKER_FLAGS "-l${GETTEXT_LIBRARY}") - endif() - set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}") From aa6506ce9617d2a889f4937b525be15d8bdcb589 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 15:12:58 +0200 Subject: [PATCH 085/107] Restore "Leave address blank" position --- src/guiMainMenu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index f557f4dc0..707a96e3b 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -217,6 +217,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) } { core::rect rect(0, 0, 400, 20); + rect += topleft_client + v2s32(160, 100+35); Environment->addStaticText(chartowchar_t(gettext("Leave address blank to start a local server.")), rect, false, true, this, -1); } { From 767280577b89503d5a0c7034fd66eae1694d0ce9 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 15:16:59 +0200 Subject: [PATCH 086/107] Reorganize cmake gettext message output to ease debugging --- src/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c018d8e56..8c6e1d450 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,18 +7,18 @@ endif(RUN_IN_PLACE) if(USE_GETTEXT) find_package(GettextLib REQUIRED) + message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}") + message(STATUS "gettext msgfmt path: ${GETTEXT_MSGFMT}") + if(WIN32) + message(STATUS "gettext library: ${GETTEXT_LIBRARY}") + message(STATUS "gettext dll: ${GETTEXT_DLL}") + message(STATUS "gettext iconv dll: ${GETTEXT_ICONV_DLL}") + endif() if (GETTEXT_FOUND) add_definitions( -DUSE_GETTEXT ) - message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}") - message(STATUS "gettext msgfmt path: ${GETTEXT_MSGFMT}") - if(WIN32) - message(STATUS "gettext library: ${GETTEXT_LIBRARY}") - message(STATUS "gettext dll: ${GETTEXT_DLL}") - message(STATUS "gettext iconv dll: ${GETTEXT_ICONV_DLL}") - endif() message(STATUS "GetText enabled") else() - message(ERROR "GetText enabled but not found, disabling") + message(STATUS "ERROR: GetText enabled but not found, disabling") set(USE_GETTEXT FALSE) endif(GETTEXT_FOUND) else(USE_GETTEXT) From cbf2ac5e8f3b4043b1eaeca0a3260b2c90b85be6 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 21 Jul 2011 15:40:00 +0200 Subject: [PATCH 087/107] * different collision box for fireflies so they now hover above the ground --- src/content_sao.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content_sao.cpp b/src/content_sao.cpp index aeeafc2f8..0b81855c1 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -809,7 +809,7 @@ void FireflySAO::step(float dtime, bool send_recommended) Move it, with collision detection */ - core::aabbox3d box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.); + core::aabbox3d box(-BS/3.,-BS*2/3.0,-BS/3., BS/3.,BS*4./3.,BS/3.); collisionMoveResult moveresult; // Maximum movement without glitches f32 pos_max_d = BS*0.25; From 8048961cc571efafe493bda2e082c27cce643414 Mon Sep 17 00:00:00 2001 From: Cyriaque Skrapits Date: Thu, 21 Jul 2011 16:09:57 +0200 Subject: [PATCH 088/107] Added french translation. --- src/CMakeLists.txt | 16 +++++++++++++++- updatelocales.sh | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72f79976c..532ac9fee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -257,7 +257,8 @@ if(BUILD_CLIENT) install(FILES ${images} DESTINATION ${DATADIR}) install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo DESTINATION locale/de/LC_MESSAGES) - + install(FILES ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo DESTINATION locale/fr/LC_MESSAGES) + if(WIN32) if(DEFINED IRRLICHT_DLL) install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) @@ -285,6 +286,7 @@ else() endif() add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMENT "mo-update [fr]: Creating locale directory.") add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo @@ -295,7 +297,19 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de COMMENT "mo-update [de]: Creating mo file." ) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo + COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/fr/minetest-c55.po + DEPENDS + ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES + ${CMAKE_SOURCE_DIR}/po/fr/minetest-c55.po + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/fr + COMMENT "mo-update [fr]: Creating mo file." + ) + add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo) +add_custom_target(translation_fr ALL COMMENT "mo update [fr]" DEPENDS ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo) + # Subdirectories diff --git a/updatelocales.sh b/updatelocales.sh index 1ac42342d..e84145107 100755 --- a/updatelocales.sh +++ b/updatelocales.sh @@ -1,4 +1,5 @@ #! /bin/bash xgettext -n -o minetest-c55.pot ./src/*.cpp ./src/*.h msgmerge -U ./po/de/minetest-c55.po minetest-c55.pot +msgmerge -U ./po/fr/minetest-c55.po minetest-c55.pot rm minetest-c55.pot From 9303283d6e3b11cc920e39198712d7acbdfbd06c Mon Sep 17 00:00:00 2001 From: Cyriaque Skrapits Date: Thu, 21 Jul 2011 16:14:18 +0200 Subject: [PATCH 089/107] Added missing .po fil.e --- po/fr/minetest-c55.po | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 po/fr/minetest-c55.po diff --git a/po/fr/minetest-c55.po b/po/fr/minetest-c55.po new file mode 100644 index 000000000..cfb76ae1a --- /dev/null +++ b/po/fr/minetest-c55.po @@ -0,0 +1,125 @@ +# French translations for minetest-c55 package. +# Copyright (C) 2011 celeron +# This file is distributed under the same license as the minetest-c55 package. +# Cyriaque 'Cisoun' Skrapits , 2011 +# +msgid "" +msgstr "" +"Project-Id-Version: 0.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-07-21 02:00+0200\n" +"PO-Revision-Date: 2011-07-21 15:48+0200\n" +"Last-Translator: Cyriaque 'Cisoun' Skrapits \n" +"Language-Team: Français <>\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: src/guiMainMenu.cpp:180 +msgid "Name/Password" +msgstr "Nom / MdP" + +#: src/guiMainMenu.cpp:202 +msgid "Address/Port" +msgstr "Adresse / Port" + +#: src/guiMainMenu.cpp:220 +msgid "Leave address blank to start a local server." +msgstr "Laisser l'adresse vide pour lancer un serveur local." + +#: src/guiMainMenu.cpp:226 +msgid "Fancy trees" +msgstr "Arbres spéciaux" + +#: src/guiMainMenu.cpp:232 +msgid "Smooth Lighting" +msgstr "Lumière douce" + +#: src/guiMainMenu.cpp:239 +msgid "Start Game / Connect" +msgstr "Démarrer / Connecter" + +#: src/guiMainMenu.cpp:247 +msgid "Change keys" +msgstr "Changer touches" + +#: src/guiMainMenu.cpp:269 +msgid "Creative Mode" +msgstr "Mode créatif" + +#: src/guiMainMenu.cpp:274 +msgid "Enable Damage" +msgstr "Activer blessures" + +#: src/guiMainMenu.cpp:281 +msgid "Delete map" +msgstr "Supprimer carte" + +#: src/guiMessageMenu.cpp:92 +#: src/guiTextInputMenu.cpp:110 +msgid "Proceed" +msgstr "OK" + +#: src/guiPasswordChange.cpp:102 +msgid "Old Password" +msgstr "Ancien mot de passe" + +#: src/guiPasswordChange.cpp:116 +msgid "New Password" +msgstr "Nouveau mot de passe" + +#: src/guiPasswordChange.cpp:129 +msgid "Confirm Password" +msgstr "Confirmer mot de passe" + +#: src/guiPasswordChange.cpp:143 +msgid "Change" +msgstr "Changer" + +#: src/guiPasswordChange.cpp:151 +msgid "Passwords do not match!" +msgstr "Mauvaise correspondance!" + +#: src/guiPauseMenu.cpp:109 +msgid "Continue" +msgstr "Continuer" + +#: src/guiPauseMenu.cpp:115 +msgid "Change Password" +msgstr "Changer mot de passe" + +#: src/guiPauseMenu.cpp:121 +msgid "Disconnect" +msgstr "Déconnection" + +#: src/guiPauseMenu.cpp:127 +msgid "Exit to OS" +msgstr "Quitter le jeu" + +#: src/guiPauseMenu.cpp:134 +msgid "" +"Keys:\n" +"- WASD: Walk\n" +"- Mouse left: dig blocks\n" +"- Mouse right: place blocks\n" +"- Mouse wheel: select item\n" +"- 0...9: select item\n" +"- Shift: sneak\n" +"- R: Toggle viewing all loaded chunks\n" +"- I: Inventory menu\n" +"- ESC: This menu\n" +"- T: Chat\n" +msgstr "" +"Touches:\n" +"- WASD: Marcher\n" +"- Clic gauche: Creuser bloc\n" +"- Clic droite: Insérer bloc\n" +"- Roulette: Sélection élément\n" +"- 0...9: Sélection élément\n" +"- Shift: S'accroupir\n" +"- R: Active la vue de tous les blocs\n" +"- I: Inventaire\n" +"- T: Chat\n" + From 4e5aac5f26b5acc6e0d7c86c25ada911b09a7426 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Thu, 21 Jul 2011 16:21:01 +0200 Subject: [PATCH 090/107] fixed not finding dll for gettext in MSVC --- cmake/Modules/FindGettextLib.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 1bc92708a..f7ac8de5d 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -31,11 +31,11 @@ IF (WIN32) NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.lib") - FIND_LIBRARY(GETTEXT_DLL + FIND_FILE(GETTEXT_DLL NAMES libintl.dll intl.dll libintl3.dll intl3.dll PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.dll") - FIND_LIBRARY(GETTEXT_ICONV_DLL + FIND_FILE(GETTEXT_ICONV_DLL NAMES libiconv2.dll PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *iconv*.lib") From 9c557c38466d19e4ffcd24cf6e8d921624a2ad3f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 21 Jul 2011 17:36:23 +0200 Subject: [PATCH 091/107] + unknown block is sick --- data/unknown_block.png | Bin 582 -> 287 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/unknown_block.png b/data/unknown_block.png index a27cb8ca9a6765af1d7a3a3885b0c7e3be9046d8..8a8e0109c90d86afb8be5fdf4ad71501cee1d459 100644 GIT binary patch delta 271 zcmV+q0r39D1fK$s8Gix*005AYXf^-<00DDSM?wIu&K&6g007xZL_t(2&z({+4udcZ zJXi3YPP8xRbJ&8E5tvXUvhfWzI#nGymkqJ=hpKZrm>P&O&{`3)2;J^irAzE9 zYjQd!XKV7E1f|OZcMg=KSrFu{W&*)I8|y%Pk~EVZ0IxO#u76Ay1efWeZ)$G%yT&Y% z*pt$wSn|dV;gl-~RKBf-t$|4d2B%Sy(uX#jmw2S?TnAX?|mLcJefn}Xnkx!fRV zYjSJycpM(@S3C}0tdS?FHii54muafHR`S{0Am#{;Pt~=84m=Id>pFOEOTRwv54@^% VzM5#CCjbBd00>D%PDHLkV1j%wckciI delta 568 zcmV-80>}NI0>%W88Gi-<001BJ|6u?C00eVFNmK|32nc)#WQYI&010qNS#tmY4#WTe z4#WYKD-Ig~00HPpL_t(Ijb)QRiyBcB#ee=;B+VdGNlY0QlVU)GMMN0vbP&==rkM|s z$}W&LevWAdEXC;}5|L>{m_}J_B`#S8d5}^};oi$6`xmW$PjT!5rp4~Uv=EX!6FM|LH|OI$zn-2oc(GcOo&RVzDtGYiZJpiYfyy0JDsTAlGa(oaDfD{}*Vy%x*@;4R zKJ^0z%Q>;@=~p}uWkm_}w+Z0tUuZRG8-42D% zpZeGQ@*@MxLa5|%2v(+QP>mV7Eu}SyDuE+6oBNUmNbWboEay;FpGj=`2mjN|r zu$*hgaj6O~e*`U++51AhS%)f Date: Thu, 21 Jul 2011 20:13:31 +0200 Subject: [PATCH 092/107] * nicer firefly texture --- data/firefly.png | Bin 150 -> 116 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/firefly.png b/data/firefly.png index d5a444b039f45e3bc76e692ed15b258357aa3047..40df7fa1cc62fd8daf90ba6ae24a93992551b9fd 100644 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|^gLZ0Lo7}w zCrGd!W-xd(>4LH0@AC%^94N?}Zq5t>-2t{?TYVNMT5w57NHDB<$-=Tymis4ACxfS} KpUXO@geCxZJRmm! literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|0z6$DLnJOI z>&&XZH>0t!aiRXj4?4_34V}i0KW7;*rg*Xef!d05uX%tVf4#w<`s&t)_C7*KuWS#O t`1il^<^TWZz3W9>eR!5IlxVMDX6SgU#+aC8egSAUgQu&X%Q~loCIFMSF>n9? From 2b3bc337087a7df15bbc7a745ee36e718e6d3950 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 21 Jul 2011 23:28:30 +0300 Subject: [PATCH 093/107] added some TODOs to main.cpp --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 3edf79bd2..505f82fc7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -339,6 +339,12 @@ TODO: Merge bahamada's audio stuff (clean patch available) TODO: Merge key configuration menu (no clean patch available) +TODO: Add some kind of content range validation to mapnode serialization + +TODO: Make sure menu text position is fixed + +TODO: Fix sector over limits error + Making it more portable: ------------------------ From 3d53cc2c1122741df2dd4506ca5e7e188824b5c3 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Thu, 21 Jul 2011 16:44:43 +0200 Subject: [PATCH 094/107] changed some lines to fit the 80chars limit --- src/guiMainMenu.cpp | 26 +++++++++++++++++--------- src/guiMessageMenu.cpp | 3 ++- src/guiPasswordChange.cpp | 13 +++++++++---- src/guiPauseMenu.cpp | 12 ++++++++---- src/guiTextInputMenu.cpp | 3 ++- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 707a96e3b..1d7f224f6 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -177,7 +177,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, 50+6); - Environment->addStaticText(chartowchar_t(gettext("Name/Password")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Name/Password")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -199,7 +200,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, 100+6); - Environment->addStaticText(chartowchar_t(gettext("Address/Port")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Address/Port")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -218,13 +220,14 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 400, 20); rect += topleft_client + v2s32(160, 100+35); - Environment->addStaticText(chartowchar_t(gettext("Leave address blank to start a local server.")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Leave address blank to start a local server.")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 250, 30); rect += topleft_client + v2s32(35, 150); Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, - chartowchar_t(gettext("Fancy trees"))); + chartowchar_t(gettext("Fancy trees"))); } { core::rect rect(0, 0, 250, 30); @@ -237,7 +240,8 @@ 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, GUI_ID_JOIN_GAME_BUTTON, chartowchar_t(gettext("Start Game / Connect"))); + Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, + chartowchar_t(gettext("Start Game / Connect"))); } // Key change button @@ -245,7 +249,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) 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, chartowchar_t(gettext("Change keys"))); + Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, + chartowchar_t(gettext("Change keys"))); } /* Server section @@ -267,19 +272,22 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 250, 30); rect += topleft_server + v2s32(35, 30); - Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, chartowchar_t(gettext("Creative Mode"))); + Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, + chartowchar_t(gettext("Creative Mode"))); } { core::rect rect(0, 0, 250, 30); rect += topleft_server + v2s32(35, 60); - Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, chartowchar_t(gettext("Enable Damage"))); + Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, + chartowchar_t(gettext("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, GUI_ID_DELETE_MAP_BUTTON, chartowchar_t(gettext("Delete map"))); + Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, + chartowchar_t(gettext("Delete map"))); } } diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp index e4e582ab1..155be6029 100644 --- a/src/guiMessageMenu.cpp +++ b/src/guiMessageMenu.cpp @@ -89,7 +89,8 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); gui::IGUIElement *e = - Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed"))); + Environment->addButton(rect, this, 257, + chartowchar_t(gettext("Proceed"))); Environment->setFocus(e); } } diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index 79601a99f..fabe75110 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -99,7 +99,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - Environment->addStaticText(chartowchar_t(gettext("Old Password")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Old Password")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -113,7 +114,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - Environment->addStaticText(chartowchar_t(gettext("New Password")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("New Password")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -126,7 +128,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); - Environment->addStaticText(chartowchar_t(gettext("Confirm Password")), rect, false, true, this, -1); + Environment->addStaticText(chartowchar_t(gettext("Confirm Password")), + rect, false, true, this, -1); } { core::rect rect(0, 0, 230, 30); @@ -148,7 +151,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) core::rect rect(0, 0, 300, 20); rect += topleft_client + v2s32(35, ypos); IGUIElement *e = - Environment->addStaticText(chartowchar_t(gettext("Passwords do not match!")), rect, false, true, this, ID_message); + Environment->addStaticText( + chartowchar_t(gettext("Passwords do not match!")), + rect, false, true, this, ID_message); e->setVisible(false); } diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index 5f40a4820..61485518c 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -106,25 +106,29 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 256, chartowchar_t(gettext("Continue"))); + Environment->addButton(rect, this, 256, + chartowchar_t(gettext("Continue"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 261, chartowchar_t(gettext("Change Password"))); + Environment->addButton(rect, this, 261, + chartowchar_t(gettext("Change Password"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 260, chartowchar_t(gettext("Disconnect"))); + Environment->addButton(rect, this, 260, + chartowchar_t(gettext("Disconnect"))); } btn_y += btn_height + btn_gap; { core::rect rect(0, 0, 140, btn_height); rect = rect + v2s32(size.X/2-140/2, btn_y); - Environment->addButton(rect, this, 257, chartowchar_t(gettext("Exit to OS"))); + Environment->addButton(rect, this, 257, + chartowchar_t(gettext("Exit to OS"))); } { diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp index b15f8bc07..252e452f5 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -107,7 +107,8 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize) { core::rect rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); - Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed"))); + Environment->addButton(rect, this, 257, + chartowchar_t(gettext("Proceed"))); } } From bc05bd8b59af9cef363cebf320f65a5283b0dea6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 08:33:08 +0200 Subject: [PATCH 095/107] Use project name for mo files --- src/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3dee7f30..feaf0eb98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -267,8 +267,8 @@ if(BUILD_CLIENT) install(FILES ${images} DESTINATION ${DATADIR}) if (USE_GETTEXT) - install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo DESTINATION locale/de/LC_MESSAGES) - install(FILES ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo DESTINATION locale/fr/LC_MESSAGES) + install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo DESTINATION locale/de/LC_MESSAGES) + install(FILES ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo DESTINATION locale/fr/LC_MESSAGES) endif() if(WIN32) @@ -298,7 +298,7 @@ if (USE_GETTEXT) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMENT "mo-update [fr]: Creating locale directory.") add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo + OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES @@ -307,7 +307,7 @@ if (USE_GETTEXT) COMMENT "mo-update [de]: Creating mo file." ) add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo + OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/fr/minetest-c55.po DEPENDS ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES @@ -316,8 +316,8 @@ if (USE_GETTEXT) COMMENT "mo-update [fr]: Creating mo file." ) - add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo) - add_custom_target(translation_fr ALL COMMENT "mo update [fr]" DEPENDS ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo) + add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo) + add_custom_target(translation_fr ALL COMMENT "mo update [fr]" DEPENDS ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo) endif(USE_GETTEXT) # Subdirectories From 0ec749317cfa36e68150dd634c2c9ffdb8027588 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 09:36:17 +0200 Subject: [PATCH 096/107] Refactor mo creation/installation --- cmake/Modules/FindGettextLib.cmake | 11 ++++++- src/CMakeLists.txt | 49 +++++++++++++++--------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index f7ac8de5d..31b261539 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -53,4 +53,13 @@ IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT) ENDIF(WIN32) ENDIF() - +IF(GETTEXT_FOUND) + SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po) + SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale//LC_MESSAGES) + SET(GETTEXT_MO_DEST_PATH locale//LC_MESSAGES) + FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*") + MACRO(SET_MO_PATHS _buildvar _destvar _locale) + STRING(REPLACE "" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH}) + STRING(REPLACE "" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH}) + ENDMACRO(SET_MO_PATHS) +ENDIF() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index feaf0eb98..4427a1380 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ if(USE_GETTEXT) endif() if (GETTEXT_FOUND) add_definitions( -DUSE_GETTEXT ) - message(STATUS "GetText enabled") + message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") else() message(STATUS "ERROR: GetText enabled but not found, disabling") set(USE_GETTEXT FALSE) @@ -267,8 +267,11 @@ if(BUILD_CLIENT) install(FILES ${images} DESTINATION ${DATADIR}) if (USE_GETTEXT) - install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo DESTINATION locale/de/LC_MESSAGES) - install(FILES ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo DESTINATION locale/fr/LC_MESSAGES) + foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) + set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) + set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH}) + endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) endif() if(WIN32) @@ -294,30 +297,28 @@ if(BUILD_SERVER) endif(BUILD_SERVER) if (USE_GETTEXT) - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.") - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES COMMENT "mo-update [fr]: Creating locale directory.") + set(MO_FILES) + foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) + set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) + add_custom_command(OUTPUT ${MO_BUILD_PATH} + COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} + COMMENT "mo-update [${LOCALE}]: Creating locale directory.") - add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo - COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-delta.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po - DEPENDS - ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES - ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de - COMMENT "mo-update [de]: Creating mo file." - ) - add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo - COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/fr/minetest-c55.po - DEPENDS - ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES - ${CMAKE_SOURCE_DIR}/po/fr/minetest-c55.po - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/fr - COMMENT "mo-update [fr]: Creating mo file." + set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest-c55.po") + + add_custom_command( + OUTPUT ${MO_FILE_PATH} + COMMAND ${GETTEXT_MSGFMT} -o ${MO_FILE_PATH} ${PO_FILE_PATH} + DEPENDS ${MO_BUILD_PATH} ${PO_FILE_PATH} + WORKING_DIRECTORY "${GETTEXT_PO_PATH}/${LOCALE}" + COMMENT "mo-update [${LOCALE}]: Creating mo file." ) - add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/${PROJECT_NAME}.mo) - add_custom_target(translation_fr ALL COMMENT "mo update [fr]" DEPENDS ${CMAKE_BINARY_DIR}/locale/fr/LC_MESSAGES/${PROJECT_NAME}.mo) + set(MO_FILES ${MO_FILES} ${MO_FILE_PATH}) + endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) + + add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES}) endif(USE_GETTEXT) # Subdirectories From 8f2409a1b41bbe32abf626b06e1b90f6cc7118c8 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 09:58:02 +0200 Subject: [PATCH 097/107] Static naming of po file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The po file should not be named c55 if we're in ∆. But since it is not exposed at installation time, we don't actually need its name to be based on the project name at all, so just call it minetest.po --- po/de/{minetest-c55.po => minetest.po} | 0 po/fr/{minetest-c55.po => minetest.po} | 0 src/CMakeLists.txt | 2 +- updatelocales.sh | 8 ++++---- 4 files changed, 5 insertions(+), 5 deletions(-) rename po/de/{minetest-c55.po => minetest.po} (100%) rename po/fr/{minetest-c55.po => minetest.po} (100%) diff --git a/po/de/minetest-c55.po b/po/de/minetest.po similarity index 100% rename from po/de/minetest-c55.po rename to po/de/minetest.po diff --git a/po/fr/minetest-c55.po b/po/fr/minetest.po similarity index 100% rename from po/fr/minetest-c55.po rename to po/fr/minetest.po diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4427a1380..61fb20680 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -305,7 +305,7 @@ if (USE_GETTEXT) COMMENT "mo-update [${LOCALE}]: Creating locale directory.") set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") - set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest-c55.po") + set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po") add_custom_command( OUTPUT ${MO_FILE_PATH} diff --git a/updatelocales.sh b/updatelocales.sh index e84145107..72ecd48d2 100755 --- a/updatelocales.sh +++ b/updatelocales.sh @@ -1,5 +1,5 @@ #! /bin/bash -xgettext -n -o minetest-c55.pot ./src/*.cpp ./src/*.h -msgmerge -U ./po/de/minetest-c55.po minetest-c55.pot -msgmerge -U ./po/fr/minetest-c55.po minetest-c55.pot -rm minetest-c55.pot +xgettext -n -o minetest.pot ./src/*.cpp ./src/*.h +msgmerge -U ./po/de/minetest.po minetest.pot +msgmerge -U ./po/fr/minetest.po minetest.pot +rm minetest.pot From aaa165f985ec30e96ae9a975c9ad96d6e99f5ac7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 10:55:05 +0200 Subject: [PATCH 098/107] updatepo cmake rule Get rid of the system-specific updatelocales.sh and introduce an updatepo cmake rule. po files are also updated before creating the mo files, and we now keep the .pot file (in the po/en directory). To stabilize the po file creation, file contents are sorted by source filename. Update po files in the process. --- cmake/Modules/FindGettextLib.cmake | 15 ++++ po/de/minetest.po | 42 +++++------ po/en/minetest.pot | 113 +++++++++++++++++++++++++++++ po/fr/minetest.po | 42 +++++------ src/CMakeLists.txt | 54 ++++++++++---- updatelocales.sh | 5 -- 6 files changed, 208 insertions(+), 63 deletions(-) create mode 100644 po/en/minetest.pot delete mode 100755 updatelocales.sh diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 31b261539..b99fd33b8 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -16,6 +16,21 @@ FIND_PROGRAM(GETTEXT_MSGFMT PATHS "${CUSTOM_GETTEXT_PATH}/bin" DOC "path to msgfmt") +FIND_PROGRAM(GETTEXT_MSGMERGE + NAMES msgmerge + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgmerge") + +FIND_PROGRAM(GETTEXT_MSGEN + NAMES msgen + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgen") + +FIND_PROGRAM(GETTEXT_EXTRACT + NAMES xgettext + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to xgettext") + # modern Linux, as well as Mac, seem to not need require special linking # they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux diff --git a/po/de/minetest.po b/po/de/minetest.po index c5ec1c7a0..69b57fd95 100644 --- a/po/de/minetest.po +++ b/po/de/minetest.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-20 16:57+0200\n" +"POT-Creation-Date: 2011-07-22 11:00+0200\n" "PO-Revision-Date: 2011-07-20 16:58+0100\n" "Last-Translator: Constantin Wenger \n" "Language-Team: Deutsch <>\n" @@ -21,44 +21,43 @@ msgstr "" msgid "Name/Password" msgstr "Name/Passwort" -#: src/guiMainMenu.cpp:202 +#: src/guiMainMenu.cpp:203 msgid "Address/Port" msgstr "Adresse / Port" -#: src/guiMainMenu.cpp:220 +#: src/guiMainMenu.cpp:223 msgid "Leave address blank to start a local server." msgstr "Lasse die Adresse frei um einen eigenen Server zu starten" -#: src/guiMainMenu.cpp:226 +#: src/guiMainMenu.cpp:230 msgid "Fancy trees" msgstr "Schöne Bäume" -#: src/guiMainMenu.cpp:232 +#: src/guiMainMenu.cpp:236 msgid "Smooth Lighting" msgstr "Besseres Licht" -#: src/guiMainMenu.cpp:239 +#: src/guiMainMenu.cpp:244 msgid "Start Game / Connect" msgstr "Spiel starten / Verbinden" -#: src/guiMainMenu.cpp:247 +#: src/guiMainMenu.cpp:253 msgid "Change keys" msgstr "Tastenbelegung ändern" -#: src/guiMainMenu.cpp:269 +#: src/guiMainMenu.cpp:276 msgid "Creative Mode" msgstr "Kreativitätsmodus" -#: src/guiMainMenu.cpp:274 +#: src/guiMainMenu.cpp:282 msgid "Enable Damage" msgstr "Schaden einschalten" -#: src/guiMainMenu.cpp:281 +#: src/guiMainMenu.cpp:290 msgid "Delete map" msgstr "Karte löschen" -#: src/guiMessageMenu.cpp:92 -#: src/guiTextInputMenu.cpp:110 +#: src/guiMessageMenu.cpp:93 src/guiTextInputMenu.cpp:111 msgid "Proceed" msgstr "Fortsetzen" @@ -66,39 +65,39 @@ msgstr "Fortsetzen" msgid "Old Password" msgstr "Altes Passwort" -#: src/guiPasswordChange.cpp:116 +#: src/guiPasswordChange.cpp:117 msgid "New Password" msgstr "Neues Passwort" -#: src/guiPasswordChange.cpp:129 +#: src/guiPasswordChange.cpp:131 msgid "Confirm Password" msgstr "Passwort wiederholen" -#: src/guiPasswordChange.cpp:143 +#: src/guiPasswordChange.cpp:146 msgid "Change" msgstr "Ändern" -#: src/guiPasswordChange.cpp:151 +#: src/guiPasswordChange.cpp:155 msgid "Passwords do not match!" msgstr "Passwörter passen nicht zusammen" -#: src/guiPauseMenu.cpp:109 +#: src/guiPauseMenu.cpp:110 msgid "Continue" msgstr "Weiter" -#: src/guiPauseMenu.cpp:115 +#: src/guiPauseMenu.cpp:117 msgid "Change Password" msgstr "Passwort ändern" -#: src/guiPauseMenu.cpp:121 +#: src/guiPauseMenu.cpp:124 msgid "Disconnect" msgstr "Verbindung trennen" -#: src/guiPauseMenu.cpp:127 +#: src/guiPauseMenu.cpp:131 msgid "Exit to OS" msgstr "Programm beenden" -#: src/guiPauseMenu.cpp:134 +#: src/guiPauseMenu.cpp:138 msgid "" "Keys:\n" "- WASD: Walk\n" @@ -122,4 +121,3 @@ msgstr "" "- R: Alle geladenen Kartenteile anzeigen, umschalten\n" "- I: Inventarmenü\n" "- T: Chat\n" - diff --git a/po/en/minetest.pot b/po/en/minetest.pot new file mode 100644 index 000000000..e242c494b --- /dev/null +++ b/po/en/minetest.pot @@ -0,0 +1,113 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: minetest\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-07-22 11:02+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/guiMainMenu.cpp:180 +msgid "Name/Password" +msgstr "" + +#: src/guiMainMenu.cpp:203 +msgid "Address/Port" +msgstr "" + +#: src/guiMainMenu.cpp:223 +msgid "Leave address blank to start a local server." +msgstr "" + +#: src/guiMainMenu.cpp:230 +msgid "Fancy trees" +msgstr "" + +#: src/guiMainMenu.cpp:236 +msgid "Smooth Lighting" +msgstr "" + +#: src/guiMainMenu.cpp:244 +msgid "Start Game / Connect" +msgstr "" + +#: src/guiMainMenu.cpp:253 +msgid "Change keys" +msgstr "" + +#: src/guiMainMenu.cpp:276 +msgid "Creative Mode" +msgstr "" + +#: src/guiMainMenu.cpp:282 +msgid "Enable Damage" +msgstr "" + +#: src/guiMainMenu.cpp:290 +msgid "Delete map" +msgstr "" + +#: src/guiMessageMenu.cpp:93 src/guiTextInputMenu.cpp:111 +msgid "Proceed" +msgstr "" + +#: src/guiPasswordChange.cpp:102 +msgid "Old Password" +msgstr "" + +#: src/guiPasswordChange.cpp:117 +msgid "New Password" +msgstr "" + +#: src/guiPasswordChange.cpp:131 +msgid "Confirm Password" +msgstr "" + +#: src/guiPasswordChange.cpp:146 +msgid "Change" +msgstr "" + +#: src/guiPasswordChange.cpp:155 +msgid "Passwords do not match!" +msgstr "" + +#: src/guiPauseMenu.cpp:110 +msgid "Continue" +msgstr "" + +#: src/guiPauseMenu.cpp:117 +msgid "Change Password" +msgstr "" + +#: src/guiPauseMenu.cpp:124 +msgid "Disconnect" +msgstr "" + +#: src/guiPauseMenu.cpp:131 +msgid "Exit to OS" +msgstr "" + +#: src/guiPauseMenu.cpp:138 +msgid "" +"Keys:\n" +"- WASD: Walk\n" +"- Mouse left: dig blocks\n" +"- Mouse right: place blocks\n" +"- Mouse wheel: select item\n" +"- 0...9: select item\n" +"- Shift: sneak\n" +"- R: Toggle viewing all loaded chunks\n" +"- I: Inventory menu\n" +"- ESC: This menu\n" +"- T: Chat\n" +msgstr "" diff --git a/po/fr/minetest.po b/po/fr/minetest.po index cfb76ae1a..b060c424c 100644 --- a/po/fr/minetest.po +++ b/po/fr/minetest.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-21 02:00+0200\n" +"POT-Creation-Date: 2011-07-22 11:00+0200\n" "PO-Revision-Date: 2011-07-21 15:48+0200\n" "Last-Translator: Cyriaque 'Cisoun' Skrapits \n" "Language-Team: Français <>\n" @@ -21,44 +21,43 @@ msgstr "" msgid "Name/Password" msgstr "Nom / MdP" -#: src/guiMainMenu.cpp:202 +#: src/guiMainMenu.cpp:203 msgid "Address/Port" msgstr "Adresse / Port" -#: src/guiMainMenu.cpp:220 +#: src/guiMainMenu.cpp:223 msgid "Leave address blank to start a local server." msgstr "Laisser l'adresse vide pour lancer un serveur local." -#: src/guiMainMenu.cpp:226 +#: src/guiMainMenu.cpp:230 msgid "Fancy trees" msgstr "Arbres spéciaux" -#: src/guiMainMenu.cpp:232 +#: src/guiMainMenu.cpp:236 msgid "Smooth Lighting" msgstr "Lumière douce" -#: src/guiMainMenu.cpp:239 +#: src/guiMainMenu.cpp:244 msgid "Start Game / Connect" msgstr "Démarrer / Connecter" -#: src/guiMainMenu.cpp:247 +#: src/guiMainMenu.cpp:253 msgid "Change keys" msgstr "Changer touches" -#: src/guiMainMenu.cpp:269 +#: src/guiMainMenu.cpp:276 msgid "Creative Mode" msgstr "Mode créatif" -#: src/guiMainMenu.cpp:274 +#: src/guiMainMenu.cpp:282 msgid "Enable Damage" msgstr "Activer blessures" -#: src/guiMainMenu.cpp:281 +#: src/guiMainMenu.cpp:290 msgid "Delete map" msgstr "Supprimer carte" -#: src/guiMessageMenu.cpp:92 -#: src/guiTextInputMenu.cpp:110 +#: src/guiMessageMenu.cpp:93 src/guiTextInputMenu.cpp:111 msgid "Proceed" msgstr "OK" @@ -66,39 +65,39 @@ msgstr "OK" msgid "Old Password" msgstr "Ancien mot de passe" -#: src/guiPasswordChange.cpp:116 +#: src/guiPasswordChange.cpp:117 msgid "New Password" msgstr "Nouveau mot de passe" -#: src/guiPasswordChange.cpp:129 +#: src/guiPasswordChange.cpp:131 msgid "Confirm Password" msgstr "Confirmer mot de passe" -#: src/guiPasswordChange.cpp:143 +#: src/guiPasswordChange.cpp:146 msgid "Change" msgstr "Changer" -#: src/guiPasswordChange.cpp:151 +#: src/guiPasswordChange.cpp:155 msgid "Passwords do not match!" msgstr "Mauvaise correspondance!" -#: src/guiPauseMenu.cpp:109 +#: src/guiPauseMenu.cpp:110 msgid "Continue" msgstr "Continuer" -#: src/guiPauseMenu.cpp:115 +#: src/guiPauseMenu.cpp:117 msgid "Change Password" msgstr "Changer mot de passe" -#: src/guiPauseMenu.cpp:121 +#: src/guiPauseMenu.cpp:124 msgid "Disconnect" msgstr "Déconnection" -#: src/guiPauseMenu.cpp:127 +#: src/guiPauseMenu.cpp:131 msgid "Exit to OS" msgstr "Quitter le jeu" -#: src/guiPauseMenu.cpp:134 +#: src/guiPauseMenu.cpp:138 msgid "" "Keys:\n" "- WASD: Walk\n" @@ -122,4 +121,3 @@ msgstr "" "- R: Active la vue de tous les blocs\n" "- I: Inventaire\n" "- T: Chat\n" - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 61fb20680..0c4b41829 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -297,28 +297,54 @@ if(BUILD_SERVER) endif(BUILD_SERVER) if (USE_GETTEXT) + add_custom_command(OUTPUT "${GETTEXT_PO_PATH}/en" + COMMAND ${CMAKE_COMMAND} -E make_directory "${GETTEXT_PO_PATH}/en" + COMMENT "po-update [en]: creating translation template base directory") + set(POT_FILE "${GETTEXT_PO_PATH}/en/minetest.pot") + file(GLOB GETTEXT_POT_DEPS *.cpp *.h) + file(GLOB GETTEXT_POT_DEPS_REL RELATIVE ${CMAKE_SOURCE_DIR} *.cpp *.h) + add_custom_command(OUTPUT ${POT_FILE} + COMMAND ${GETTEXT_EXTRACT} -F -n -o ${POT_FILE} ${GETTEXT_POT_DEPS_REL} + DEPENDS "${GETTEXT_PO_PATH}/en" ${GETTEXT_POT_DEPS} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "po-update [en]: updating translation template") + + set(PO_FILES) set(MO_FILES) + foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) - set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) - add_custom_command(OUTPUT ${MO_BUILD_PATH} - COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} - COMMENT "mo-update [${LOCALE}]: Creating locale directory.") + # skip the 'en' locale which is treated separately + if (NOT LOCALE STREQUAL "en") + set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po") + add_custom_command(OUTPUT ${PO_FILE_PATH} + COMMAND ${GETTEXT_MSGMERGE} -F -U ${PO_FILE_PATH} ${POT_FILE} + DEPENDS ${POT_FILE} + WORKING_DIRECTORY "${GETTEXT_PO_PATH}/${LOCALE}" + COMMENT "po-update [${LOCALE}]: updating strings") - set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") - set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po") - add_custom_command( - OUTPUT ${MO_FILE_PATH} - COMMAND ${GETTEXT_MSGFMT} -o ${MO_FILE_PATH} ${PO_FILE_PATH} - DEPENDS ${MO_BUILD_PATH} ${PO_FILE_PATH} - WORKING_DIRECTORY "${GETTEXT_PO_PATH}/${LOCALE}" - COMMENT "mo-update [${LOCALE}]: Creating mo file." - ) + set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) + add_custom_command(OUTPUT ${MO_BUILD_PATH} + COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} + COMMENT "mo-update [${LOCALE}]: Creating locale directory.") - set(MO_FILES ${MO_FILES} ${MO_FILE_PATH}) + set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + + add_custom_command( + OUTPUT ${MO_FILE_PATH} + COMMAND ${GETTEXT_MSGFMT} -o ${MO_FILE_PATH} ${PO_FILE_PATH} + DEPENDS ${MO_BUILD_PATH} ${PO_FILE_PATH} + WORKING_DIRECTORY "${GETTEXT_PO_PATH}/${LOCALE}" + COMMENT "mo-update [${LOCALE}]: Creating mo file." + ) + + set(MO_FILES ${MO_FILES} ${MO_FILE_PATH}) + set(PO_FILES ${PO_FILES} ${PO_FILE_PATH}) + endif(NOT LOCALE STREQUAL "en") endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES}) + add_custom_target(updatepo COMMENT "po update" DEPENDS ${PO_FILES}) endif(USE_GETTEXT) # Subdirectories diff --git a/updatelocales.sh b/updatelocales.sh deleted file mode 100755 index 72ecd48d2..000000000 --- a/updatelocales.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/bash -xgettext -n -o minetest.pot ./src/*.cpp ./src/*.h -msgmerge -U ./po/de/minetest.po minetest.pot -msgmerge -U ./po/fr/minetest.po minetest.pot -rm minetest.pot From bf3dfec7d6d171c5c83142319067153f2637b0a8 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Fri, 22 Jul 2011 12:54:07 +0200 Subject: [PATCH 099/107] fixed problem with displaying special chars --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index b6a53566e..a7634a3c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1132,7 +1132,7 @@ int main(int argc, char *argv[]) // Create user data directory fs::CreateDir(porting::path_userdata); - setlocale(LC_ALL, ""); + setlocale(LC_MESSAGES, ""); bindtextdomain("minetest-c55", (porting::path_userdata+"/locale").c_str()); textdomain("minetest-c55"); From 965352287391eb46695546efce3e26a2e576a340 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 14:42:04 +0200 Subject: [PATCH 100/107] Declare USE_GETTEXT option --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c4b41829..dc9dc03a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,8 @@ if(RUN_IN_PLACE) add_definitions ( -DRUN_IN_PLACE ) endif(RUN_IN_PLACE) +OPTION(USE_GETTEXT "Use GetText for internationalization" OFF) + if(USE_GETTEXT) find_package(GettextLib REQUIRED) message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}") From b278988924724616b2070ed54d0c323504ebdff0 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Wed, 20 Jul 2011 19:57:44 +0200 Subject: [PATCH 101/107] updated some parts which don't really make a problem but are better this way --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 662f2770b..763974fd0 100644 --- a/README.txt +++ b/README.txt @@ -153,7 +153,7 @@ Compiling on Windows: ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib GETTEXT_BIN_DIR DIR/gettext/bin GETTEXT_INCLUDE_DIR DIR/gettext/include - GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib + GETTEXT_LIBRARIES DIR/gettext/lib/libintl.lib GETTEXT_MSGFMT DIR/gettext/bin/msgfmt ----------------- - Hit "Configure" From a12229f27148b9aec64c0fdeb1d739ad2062ac93 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Fri, 22 Jul 2011 20:19:43 +0200 Subject: [PATCH 102/107] fixed some problems with filenames of the translations --- src/CMakeLists.txt | 2 +- src/main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc9dc03a6..c93762cab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -330,7 +330,7 @@ if (USE_GETTEXT) COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} COMMENT "mo-update [${LOCALE}]: Creating locale directory.") - set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(MO_FILE_PATH "${MO_BUILD_PATH}/minetest.mo") add_custom_command( OUTPUT ${MO_FILE_PATH} diff --git a/src/main.cpp b/src/main.cpp index a7634a3c1..b94d0c361 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1133,8 +1133,8 @@ int main(int argc, char *argv[]) fs::CreateDir(porting::path_userdata); setlocale(LC_MESSAGES, ""); - bindtextdomain("minetest-c55", (porting::path_userdata+"/locale").c_str()); - textdomain("minetest-c55"); + bindtextdomain("minetest", (porting::path_userdata+"/locale").c_str()); + textdomain("minetest"); // Initialize debug streams #ifdef RUN_IN_PLACE From 84c370b1db05c21b63256e956a028084e482a8c4 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Fri, 22 Jul 2011 20:55:00 +0200 Subject: [PATCH 103/107] change in readme of a lib --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 763974fd0..662f2770b 100644 --- a/README.txt +++ b/README.txt @@ -153,7 +153,7 @@ Compiling on Windows: ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib GETTEXT_BIN_DIR DIR/gettext/bin GETTEXT_INCLUDE_DIR DIR/gettext/include - GETTEXT_LIBRARIES DIR/gettext/lib/libintl.lib + GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib GETTEXT_MSGFMT DIR/gettext/bin/msgfmt ----------------- - Hit "Configure" From 6c2d95f8686a7c08ed8648aa111accef50f58f73 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 22 Jul 2011 21:53:50 +0200 Subject: [PATCH 104/107] * key change menu now saving immediately --- src/guiKeyChangeMenu.cpp | 2 +- src/keycode.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index 3e594aeca..4a11cf93c 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -338,7 +338,7 @@ bool GUIKeyChangeMenu::acceptInput() 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?! + clearKeyCache(); return true; } void GUIKeyChangeMenu::init_keys() diff --git a/src/keycode.h b/src/keycode.h index 9c62004d8..300682b12 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -24,11 +24,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include irr::EKEY_CODE keyname_to_keycode(const char *name); +std::string keycode_to_keyname(s32 keycode); // Key configuration getter irr::EKEY_CODE getKeySetting(const char *settingname); -std::string keycode_to_keyname(s32 keycode); -void clearCache(); + +// Clear fast lookup cache +void clearKeyCache(); #endif From 7da02e05a6b97eb70fd17abdfdb38d8f99fabad9 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 22 Jul 2011 21:56:00 +0200 Subject: [PATCH 105/107] * README updated --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index e03bdae25..82fcdd331 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ 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) +* Submenu for key assignment * configurable far mesh tree display (boolean) * configurable far mesh rendering distance * volumetric clouds (using fake shading) From 98be7787660d81c1b5e0fd2408e754fdc3238288 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 23 Jul 2011 16:08:07 +0300 Subject: [PATCH 106/107] switched my textures back --- data/player.png | Bin 652 -> 212 bytes data/player_back.png | Bin 292 -> 201 bytes data/unknown_block.png | Bin 287 -> 582 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/player.png b/data/player.png index 60ac4854ba00dc30c692e4fafdd6a0810d0806fb..90adf97476ecd3442dcd435201658ebfaef9d7ab 100644 GIT binary patch delta 172 zcmV;d08{^r1=InM90dRyiTKQsE*O7?Nkl569sGa~0-TA{S>tn2Gi5US)fn%_IB-w+G!_iCux}jBA8FpZ a2p}uF=p{1q#6|1?0000uX70004VQb$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*} diff --git a/data/player_back.png b/data/player_back.png index 447c1fd8f149788f85f9aa350f27361d5e8459d8..530aa7519b95a650ce4fea2612b2dced58becdbc 100644 GIT binary patch delta 173 zcmV;e08;;?0?7f8B!3BTNLh0L01m_e01m_fl`9S#0001cNklf%00000NkvXXu0mjfat}zN delta 265 zcmV+k0rvjM0i*(uB!2;OQb$4nuFf3k0002qNkltn$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?>_&}NI0>%W88Gi-<001BJ|6u?C00eVFNmK|32nc)#WQYI&010qNS#tmY4#WTe z4#WYKD-Ig~00HPpL_t(Ijb)QRiyBcB#ee=;B+VdGNlY0QlVU)GMMN0vbP&==rkM|s z$}W&LevWAdEXC;}5|L>{m_}J_B`#S8d5}^};oi$6`xmW$PjT!5rp4~Uv=EX!6FM|LH|OI$zn-2oc(GcOo&RVzDtGYiZJpiYfyy0JDsTAlGa(oaDfD{}*Vy%x*@;4R zKJ^0z%Q>;@=~p}uWkm_}w+Z0tUuZRG8-42D% zpZeGQ@*@MxLa5|%2v(+QP>mV7Eu}SyDuE+6oBNUmNbWboEay;FpGj=`2mjN|r zu$*hgaj6O~e*`U++51AhS%)fP&O&{`3)2;J^irAzE9 zYjQd!XKV7E1f|OZcMg=KSrFu{W&*)I8|y%Pk~EVZ0IxO#u76Ay1efWeZ)$G%yT&Y% z*pt$wSn|dV;gl-~RKBf-t$|4d2B%Sy(uX#jmw2S?TnAX?|mLcJefn}Xnkx!fRV zYjSJycpM(@S3C}0tdS?FHii54muafHR`S{0Am#{;Pt~=84m=Id>pFOEOTRwv54@^% VzM5#CCjbBd00>D%PDHLkV1j%wckciI From 976ec31c1faedc3a34935c3aafd6a868e222d1ad Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 23 Jul 2011 16:46:34 +0300 Subject: [PATCH 107/107] switched to old transformLiquids, new one is not ready --- src/map.cpp | 437 +++++++++++++++++++++++++++------------------------- 1 file changed, 223 insertions(+), 214 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index e1769b8ef..ab4acd4d5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1540,17 +1540,6 @@ void Map::PrintInfo(std::ostream &out) #define WATER_DROP_BOOST 4 -enum NeighborType { - NEIGHBOR_UPPER, - NEIGHBOR_SAME_LEVEL, - NEIGHBOR_LOWER -}; -struct NodeNeighbor { - MapNode n; - NeighborType t; - v3s16 p; -}; - void Map::transformLiquids(core::map & modified_blocks) { DSTACK(__FUNCTION_NAME); @@ -1570,220 +1559,240 @@ void Map::transformLiquids(core::map & modified_blocks) v3s16 p0 = m_transforming_liquid.pop_front(); MapNode n0 = getNodeNoEx(p0); - - /* - Collect information about current node - */ - s8 liquid_level = -1; - u8 liquid_kind = CONTENT_IGNORE; - LiquidType liquid_type = content_features(n0.d).liquid_type; - switch (liquid_type) { - case LIQUID_SOURCE: - liquid_level = 8; - liquid_kind = content_features(n0.d).liquid_alternative_flowing; - break; - case LIQUID_FLOWING: - liquid_level = (n0.param2 & LIQUID_LEVEL_MASK); - liquid_kind = n0.d; - break; - case LIQUID_NONE: - // if this is an air node, it *could* be transformed into a liquid. otherwise, - // continue with the next node. - if (n0.d != CONTENT_AIR) - continue; - liquid_kind = CONTENT_AIR; - break; - } - - /* - Collect information about the environment - */ - v3s16 dirs[6] = { - v3s16( 0, 1, 0), // top - v3s16( 0,-1, 0), // bottom - v3s16( 1, 0, 0), // right - v3s16(-1, 0, 0), // left - v3s16( 0, 0, 1), // back - v3s16( 0, 0,-1), // front - }; - NodeNeighbor sources[6]; // surrounding sources - int num_sources = 0; - NodeNeighbor flows[6]; // surrounding flowing liquid nodes - int num_flows = 0; - NodeNeighbor airs[6]; // surrounding air - int num_airs = 0; - NodeNeighbor neutrals[6]; // nodes that are solid or another kind of liquid - int num_neutrals = 0; - bool flowing_down = false; - for (u16 i = 0; i < 6; i++) { - NeighborType nt = NEIGHBOR_SAME_LEVEL; - switch (i) { - case 0: - nt = NEIGHBOR_UPPER; - break; - case 1: - nt = NEIGHBOR_LOWER; - break; - } - v3s16 npos = p0 + dirs[i]; - NodeNeighbor nb = {getNodeNoEx(npos), nt, npos}; - switch (content_features(nb.n.d).liquid_type) { - case LIQUID_NONE: - if (nb.n.d == CONTENT_AIR) { - airs[num_airs++] = nb; - // if the current node happens to be a flowing node, it will start to flow down here. - if (nb.t == NEIGHBOR_LOWER) - flowing_down = true; - } else { - neutrals[num_neutrals++] = nb; - } - break; - case LIQUID_SOURCE: - // if this node is not (yet) of a liquid type, choose the first liquid type we encounter - if (liquid_kind == CONTENT_AIR) - liquid_kind = content_features(nb.n.d).liquid_alternative_flowing; - if (content_features(nb.n.d).liquid_alternative_flowing !=liquid_kind) { - neutrals[num_neutrals++] = nb; - } else { - sources[num_sources++] = nb; - } - break; - case LIQUID_FLOWING: - // if this node is not (yet) of a liquid type, choose the first liquid type we encounter - if (liquid_kind == CONTENT_AIR) - liquid_kind = content_features(nb.n.d).liquid_alternative_flowing; - if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) { - neutrals[num_neutrals++] = nb; - } else { - flows[num_flows++] = nb; - if (nb.t == NEIGHBOR_LOWER) - flowing_down = true; - } - break; - } - } - - /* - decide on the type (and possibly level) of the current node - */ - u8 new_node_content; - s8 new_node_level = -1; - if (num_sources >= 2 || liquid_type == LIQUID_SOURCE) { - // liquid_kind will be set to either the flowing alternative of the node (if it's a liquid) - // or the flowing alternative of the first of the surrounding sources (if it's air), so - // it's perfectly safe to use liquid_kind here to determine the new node content. - new_node_content = content_features(liquid_kind).liquid_alternative_source; - } else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) { - // liquid_kind is set properly, see above - new_node_content = liquid_kind; - new_node_level = 7; - } else { - // no surrounding sources, so get the maximum level that can flow into this node - for (u16 i = 0; i < num_flows; i++) { - u8 nb_liquid_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); - switch (flows[i].t) { - case NEIGHBOR_UPPER: - if (nb_liquid_level + WATER_DROP_BOOST > new_node_level) { - new_node_level = 7; - if (nb_liquid_level + WATER_DROP_BOOST < 7) - new_node_level = nb_liquid_level + WATER_DROP_BOOST; - } - break; - case NEIGHBOR_LOWER: - break; - case NEIGHBOR_SAME_LEVEL: - if ((flows[i].n.param2 & LIQUID_FLOW_DOWN_MASK) != LIQUID_FLOW_DOWN_MASK && - nb_liquid_level > 0 && nb_liquid_level - 1 > new_node_level) { - new_node_level = nb_liquid_level - 1; - } - break; - } - } - // don't flow as far in open terrain - if there isn't at least one adjacent solid block, - // substract another unit from the resulting water level. - if (!flowing_down && new_node_level >= 1) { - bool at_wall = false; - for (u16 i = 0; i < num_neutrals; i++) { - if (neutrals[i].t == NEIGHBOR_SAME_LEVEL) { - at_wall = true; - break; - } - } - if (!at_wall) - new_node_level -= 1; - } - - if (new_node_level >= 0) - new_node_content = liquid_kind; - else - new_node_content = CONTENT_AIR; - } - - /* - check if anything has changed. if not, just continue with the next node. - */ - if (new_node_content == n0.d && (content_features(n0.d).liquid_type != LIQUID_FLOWING || - ((n0.param2 & LIQUID_LEVEL_MASK) == (u8)new_node_level && - ((n0.param2 & LIQUID_FLOW_DOWN_MASK) == LIQUID_FLOW_DOWN_MASK) - == flowing_down))) + + // Don't deal with non-liquids + if(content_liquid(n0.d) == false) continue; - - + + bool is_source = !content_flowing_liquid(n0.d); + + u8 liquid_level = 8; + if(is_source == false) + liquid_level = n0.param2 & 0x0f; + + // Turn possible source into non-source + u8 nonsource_c = make_liquid_flowing(n0.d); + /* - update the current node - */ - bool flow_down_enabled = (flowing_down && ((n0.param2 & LIQUID_FLOW_DOWN_MASK) != LIQUID_FLOW_DOWN_MASK)); - n0.d = new_node_content; - if (content_features(n0.d).liquid_type == LIQUID_FLOWING) { - // set level to last 3 bits, flowing down bit to 4th bit - n0.param2 = (flowing_down ? LIQUID_FLOW_DOWN_MASK : 0x00) | (new_node_level & LIQUID_LEVEL_MASK); - } else { - n0.param2 = 0; + If not source, check that some node flows into this one + and what is the level of liquid in this one + */ + if(is_source == false) + { + s8 new_liquid_level_max = -1; + + v3s16 dirs_from[5] = { + v3s16(0,1,0), // top + v3s16(0,0,1), // back + v3s16(1,0,0), // right + v3s16(0,0,-1), // front + v3s16(-1,0,0), // left + }; + for(u16 i=0; i<5; i++) + { + bool from_top = (i==0); + + v3s16 p2 = p0 + dirs_from[i]; + MapNode n2 = getNodeNoEx(p2); + + if(content_liquid(n2.d)) + { + u8 n2_nonsource_c = make_liquid_flowing(n2.d); + // Check that the liquids are the same type + if(n2_nonsource_c != nonsource_c) + { + dstream<<"WARNING: Not handling: different liquids" + " collide"<= 7 - WATER_DROP_BOOST) + new_liquid_level = 7; + else + new_liquid_level = n2_liquid_level + WATER_DROP_BOOST; + } + else if(n2_liquid_level > 0) + { + new_liquid_level = n2_liquid_level - 1; + } + + if(new_liquid_level > new_liquid_level_max) + new_liquid_level_max = new_liquid_level; + } + } //for + + /* + If liquid level should be something else, update it and + add all the neighboring water nodes to the transform queue. + */ + if(new_liquid_level_max != liquid_level) + { + if(new_liquid_level_max == -1) + { + // Remove water alltoghether + n0.d = CONTENT_AIR; + n0.param2 = 0; + setNode(p0, n0); + } + else + { + n0.param2 = new_liquid_level_max; + setNode(p0, n0); + } + + // Block has been modified + { + v3s16 blockpos = getNodeBlockPos(p0); + MapBlock *block = getBlockNoCreateNoEx(blockpos); + if(block != NULL) + modified_blocks.insert(blockpos, block); + } + + /* + Add neighboring non-source liquid nodes to transform queue. + */ + v3s16 dirs[6] = { + v3s16(0,0,1), // back + v3s16(0,1,0), // top + v3s16(1,0,0), // right + v3s16(0,0,-1), // front + v3s16(0,-1,0), // bottom + v3s16(-1,0,0), // left + }; + for(u16 i=0; i<6; i++) + { + v3s16 p2 = p0 + dirs[i]; + + MapNode n2 = getNodeNoEx(p2); + if(content_flowing_liquid(n2.d)) + { + m_transforming_liquid.push_back(p2); + } + } + } } - setNode(p0, n0); - v3s16 blockpos = getNodeBlockPos(p0); - MapBlock *block = getBlockNoCreateNoEx(blockpos); - if(block != NULL) - modified_blocks.insert(blockpos, block); - + + // Get a new one from queue if the node has turned into non-water + if(content_liquid(n0.d) == false) + continue; + /* - enqueue neighbors for update if neccessary - */ - switch (content_features(n0.d).liquid_type) { - case LIQUID_SOURCE: - // make sure source flows into all neighboring nodes - for (u16 i = 0; i < num_flows; i++) - if (flows[i].t != NEIGHBOR_UPPER) - m_transforming_liquid.push_back(flows[i].p); - for (u16 i = 0; i < num_airs; i++) - if (airs[i].t != NEIGHBOR_UPPER) - m_transforming_liquid.push_back(airs[i].p); - break; - case LIQUID_NONE: - // this flow has turned to air; neighboring flows might need to do the same - for (u16 i = 0; i < num_flows; i++) - m_transforming_liquid.push_back(flows[i].p); - break; - case LIQUID_FLOWING: - for (u16 i = 0; i < num_flows; i++) { - u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK); - // liquid_level is still the ORIGINAL level of this node. - if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) || - flow_down_enabled)) - m_transforming_liquid.push_back(flows[i].p); + Flow water from this node + */ + v3s16 dirs_to[5] = { + v3s16(0,-1,0), // bottom + v3s16(0,0,1), // back + v3s16(1,0,0), // right + v3s16(0,0,-1), // front + v3s16(-1,0,0), // left + }; + for(u16 i=0; i<5; i++) + { + bool to_bottom = (i == 0); + + // If liquid is at lowest possible height, it's not going + // anywhere except down + if(liquid_level == 0 && to_bottom == false) + continue; + + u8 liquid_next_level = 0; + // If going to bottom + if(to_bottom) + { + //liquid_next_level = 7; + if(liquid_level >= 7 - WATER_DROP_BOOST) + liquid_next_level = 7; + else + liquid_next_level = liquid_level + WATER_DROP_BOOST; + } + else + liquid_next_level = liquid_level - 1; + + bool n2_changed = false; + bool flowed = false; + + v3s16 p2 = p0 + dirs_to[i]; + + MapNode n2 = getNodeNoEx(p2); + //dstream<<"[1] n2.param="<<(int)n2.param< 0)) - m_transforming_liquid.push_back(airs[i].p); + bool n2_is_source = !content_flowing_liquid(n2.d); + u8 n2_liquid_level = 8; + if(n2_is_source == false) + n2_liquid_level = n2.param2 & 0x07; + + if(to_bottom) + { + flowed = true; } + + if(n2_is_source) + { + // Just flow into the source, nothing changes. + // n2_changed is not set because destination didn't change + flowed = true; + } + else + { + if(liquid_next_level > liquid_level) + { + n2.param2 = liquid_next_level; + setNode(p2, n2); + + n2_changed = true; + flowed = true; + } + } + } + else if(n2.d == CONTENT_AIR) + { + n2.d = nonsource_c; + n2.param2 = liquid_next_level; + setNode(p2, n2); + + n2_changed = true; + flowed = true; + } + + //dstream<<"[2] n2.param="<<(int)n2.param<= 100000) - if(loopcount >= initial_size * 10) { + if(loopcount >= initial_size * 1) break; - } } //dstream<<"Map::transformLiquids(): loopcount="<