+ return false;
+}
+
+static inline void create_formspec_menu(GUIFormSpecMenu** cur_formspec,
+ InventoryManager *invmgr, IGameDef *gamedef,
+ IWritableTextureSource* tsrc, IrrlichtDevice * device,
+ IFormSource* fs_src, TextDest* txt_dest
+ ) {
+
+ if (*cur_formspec == 0) {
+ *cur_formspec = new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr,
+ invmgr, gamedef, tsrc, fs_src, txt_dest, cur_formspec );
+ (*cur_formspec)->doPause = false;
+ (*cur_formspec)->drop();
+ }
+ else {
+ (*cur_formspec)->setFormSource(fs_src);
+ (*cur_formspec)->setTextDest(txt_dest);
+ }
+}
+
+#ifdef __ANDROID__
+#define SIZE_TAG "size[11,5.5]"
+#else
+#define SIZE_TAG "size[11,5.5,true]"
+#endif
+
+static void show_chat_menu(GUIFormSpecMenu** cur_formspec,
+ InventoryManager *invmgr, IGameDef *gamedef,
+ IWritableTextureSource* tsrc, IrrlichtDevice * device,
+ Client* client, std::string text)
+{
+ std::string formspec =
+ FORMSPEC_VERSION_STRING
+ SIZE_TAG
+ "field[3,2.35;6,0.5;f_text;;" + text + "]"
+ "button_exit[4,3;3,0.5;btn_send;" + wide_to_narrow(wstrgettext("Proceed")) + "]"
+ ;
+
+ /* Create menu */
+ /* Note: FormspecFormSource and LocalFormspecHandler
+ * are deleted by guiFormSpecMenu */
+ FormspecFormSource* fs_src = new FormspecFormSource(formspec);
+ LocalFormspecHandler* txt_dst = new LocalFormspecHandler("MT_CHAT_MENU", client);
+
+ create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst);
+}
+
+static void show_deathscreen(GUIFormSpecMenu** cur_formspec,
+ InventoryManager *invmgr, IGameDef *gamedef,
+ IWritableTextureSource* tsrc, IrrlichtDevice * device, Client* client)
+{
+ std::string formspec =
+ std::string(FORMSPEC_VERSION_STRING) +
+ SIZE_TAG
+ "bgcolor[#320000b4;true]"
+ "label[4.85,1.35;You died.]"
+ "button_exit[4,3;3,0.5;btn_respawn;" + gettext("Respawn") + "]"
+ ;
+
+ /* Create menu */
+ /* Note: FormspecFormSource and LocalFormspecHandler
+ * are deleted by guiFormSpecMenu */
+ FormspecFormSource* fs_src = new FormspecFormSource(formspec);
+ LocalFormspecHandler* txt_dst = new LocalFormspecHandler("MT_DEATH_SCREEN", client);
+
+ create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst);
+}
+
+/******************************************************************************/
+static void show_pause_menu(GUIFormSpecMenu** cur_formspec,
+ InventoryManager *invmgr, IGameDef *gamedef,
+ IWritableTextureSource* tsrc, IrrlichtDevice * device,
+ bool singleplayermode)
+{
+#ifdef __ANDROID__
+ std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
+ "No menu visible:\n"
+ "- single tap: button activate\n"
+ "- double tap: place/use\n"
+ "- slide finger: look around\n"
+ "Menu/Inventory visible:\n"
+ "- double tap (outside):\n"
+ " -->close\n"
+ "- touch stack, touch slot:\n"
+ " --> move stack\n"
+ "- touch&drag, tap 2nd finger\n"
+ " --> place single item to slot\n"
+ ));
+#else
+ std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
+ "- WASD: move\n"
+ "- Space: jump/climb\n"
+ "- Shift: sneak/go down\n"
+ "- Q: drop item\n"
+ "- I: inventory\n"
+ "- Mouse: turn/look\n"
+ "- Mouse left: dig/punch\n"
+ "- Mouse right: place/use\n"
+ "- Mouse wheel: select item\n"
+ "- T: chat\n"
+ ));
+#endif
+ float ypos = singleplayermode ? 1.0 : 0.5;
+ std::ostringstream os;
+
+ os << FORMSPEC_VERSION_STRING << SIZE_TAG
+ << "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
+ << wide_to_narrow(wstrgettext("Continue")) << "]";
+
+ if (!singleplayermode) {
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
+ << wide_to_narrow(wstrgettext("Change Password")) << "]";
+ }
+
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
+ << wide_to_narrow(wstrgettext("Sound Volume")) << "]";
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
+ << wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
+ << wide_to_narrow(wstrgettext("Exit to OS")) << "]"
+ << "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
+ << "textarea[0.4,0.25;3.5,6;;" << "Minetest\n"
+ << minetest_build_info << "\n"
+ << "path_user = " << wrap_rows(porting::path_user, 20)
+ << "\n;]";
+
+ /* Create menu */
+ /* Note: FormspecFormSource and LocalFormspecHandler *
+ * are deleted by guiFormSpecMenu */
+ FormspecFormSource* fs_src = new FormspecFormSource(os.str());
+ LocalFormspecHandler* txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");
+
+ create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst);
+
+ (*cur_formspec)->doPause = true;