aboutsummaryrefslogtreecommitdiff
path: root/src/guiKeyChangeMenu.cpp
Commit message (Expand)AuthorAge
* Add configurable key bindings for hotbar scrolling, and for changing volume.Wuzzy2017-05-06
* Change command prefix to "." and add "help" command.red-0012017-03-26
* Add zoom, tweakable with zoom_fov, default key: Z (like optifine)Esteban I. Ruiz Moreno2016-08-10
* Fix for cropped text "Toggle Cinematic"Snipie2016-07-05
* Mainmenu: Standardize the menu button order and sizesSmallJoker2016-04-28
* Change i++ to ++iDavid Jones2015-08-25
* Close keybind settings menu with escest312015-06-30
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* Add camera smoothing and cinematic mode (F8)rubenwardy2015-02-25
* Minor fixes in translationsngosang2015-02-12
* Reduce gettext wide/narrow and string/char* conversionsShadowNinja2015-02-05
* Create faster key cache for main game loop (client)Craig Robbins2014-11-10
* Fix win32/msvc i18n (quite UGLY version, blame Microsoft)sapier2013-11-11
* fix memory leaks introduced by invalid gettext usagesapier2013-04-07
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Translate key functions in key change menuPilzAdam2013-01-30
* Fixed two typo's in commit 615fd498bcdannydark2013-01-07
* Fix typo doubletab -> doubletapPilzAdam2013-01-04
* Switch to fly mode if spacebar is doubleclickedPilzAdam2013-01-04
* Only fly through walls in noclip mode wich requires the noclip privilegePilzAdam2012-12-11
* Add aux1_descends to key change menuPerttu Ahola2012-09-05
* Fix GUIKeyChangeMenu so that '/' can be inserted on a finnish keyboardPerttu Ahola2012-09-01
* A bunch of GUIKeyChangeMenu fixesThomas Lauro2012-09-01
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* Use gettext for more basic user interface stringsPerttu Ahola2012-06-04
* World creation button and dialog and functionalityPerttu Ahola2012-03-13
* Add a note about minetest.conf in the key change dialog (because it sucks)Perttu Ahola2012-03-11
* Chat console, including a number of rebases and modifications.Kahrl2012-03-10
* Add IDropAction and related stuffKahrl2011-11-29
* Header file tweaking; mainly for speedPerttu Ahola2011-10-12
* Introduce hotkey for calling up a command windowGiuseppe Bilotta2011-08-22
* Overhaul the input systemGiuseppe Bilotta2011-08-22
* Fix typos in key namesGiuseppe Bilotta2011-08-22
* Clean up key names handlingGiuseppe Bilotta2011-08-12
* marked strings as translationConstantin Wenger2011-08-05
* fixed displaying special chars in the keychange menuConstantin Wenger2011-08-05
* Use wgettextGiuseppe Bilotta2011-08-02
* Get rid of unused variablesGiuseppe Bilotta2011-08-02
* set some more text to gettext and updated po filesConstantin Wenger2011-07-30
* Removed remaining -delta referencesPerttu Ahola2011-07-30
* * key change menu now saving immediatelyPerttu Ahola2011-07-22
* added new submenu for key assignmentteddydestodes2011-06-01
pan>, true)); find_paths.push_back(GameFindPath( user + DIR_DELIM + "games" + DIR_DELIM + id, true)); find_paths.push_back(GameFindPath( share + DIR_DELIM + "games" + DIR_DELIM + id + "_game", false)); find_paths.push_back(GameFindPath( share + DIR_DELIM + "games" + DIR_DELIM + id, false)); // Find game directory std::string game_path; bool user_game = true; // Game is in user's directory for(u32 i=0; i<find_paths.size(); i++){ const std::string &try_path = find_paths[i].path; if(fs::PathExists(try_path)){ game_path = try_path; user_game = find_paths[i].user_specific; break; } } if(game_path == "") return SubgameSpec(); // Find mod directories std::set<std::string> mods_paths; mods_paths.insert(game_path + DIR_DELIM + "mods"); if(!user_game) mods_paths.insert(share + DIR_DELIM + "mods" + DIR_DELIM + id); if(user != share || user_game) mods_paths.insert(user + DIR_DELIM + "mods" + DIR_DELIM + id); std::string game_name = getGameName(game_path); if(game_name == "") game_name = id; return SubgameSpec(id, game_path, mods_paths, game_name); } SubgameSpec findWorldSubgame(const std::string &world_path) { std::string world_gameid = getWorldGameId(world_path, true); // See if world contains an embedded game; if so, use it. std::string world_gamepath = world_path + DIR_DELIM + "game"; if(fs::PathExists(world_gamepath)){ SubgameSpec gamespec; gamespec.id = world_gameid; gamespec.path = world_gamepath; gamespec.mods_paths.insert(world_gamepath + DIR_DELIM + "mods"); gamespec.name = getGameName(world_gamepath); if(gamespec.name == "") gamespec.name = "unknown"; return gamespec; } return findSubgame(world_gameid); } std::set<std::string> getAvailableGameIds() { std::set<std::string> gameids; std::set<std::string> gamespaths; gamespaths.insert(porting::path_share + DIR_DELIM + "games"); gamespaths.insert(porting::path_user + DIR_DELIM + "games"); for(std::set<std::string>::const_iterator i = gamespaths.begin(); i != gamespaths.end(); i++){ std::vector<fs::DirListNode> dirlist = fs::GetDirListing(*i); for(u32 j=0; j<dirlist.size(); j++){ if(!dirlist[j].dir) continue; const char *ends[] = {"_game", NULL}; std::string shorter = removeStringEnd(dirlist[j].name, ends); if(shorter != "") gameids.insert(shorter); else gameids.insert(dirlist[j].name); } } return gameids; } std::vector<SubgameSpec> getAvailableGames() { std::vector<SubgameSpec> specs; std::set<std::string> gameids = getAvailableGameIds(); for(std::set<std::string>::const_iterator i = gameids.begin(); i != gameids.end(); i++) specs.push_back(findSubgame(*i)); return specs; } #define LEGACY_GAMEID "minetest" bool getWorldExists(const std::string &world_path) { return (fs::PathExists(world_path + DIR_DELIM + "map_meta.txt") || fs::PathExists(world_path + DIR_DELIM + "world.mt")); } std::string getWorldGameId(const std::string &world_path, bool can_be_legacy) { std::string conf_path = world_path + DIR_DELIM + "world.mt"; Settings conf; bool succeeded = conf.readConfigFile(conf_path.c_str()); if(!succeeded){ if(can_be_legacy){ // If map_meta.txt exists, it is probably an old minetest world if(fs::PathExists(world_path + DIR_DELIM + "map_meta.txt")) return LEGACY_GAMEID; } return ""; } if(!conf.exists("gameid")) return ""; // The "mesetint" gameid has been discarded if(conf.get("gameid") == "mesetint") return "minetest"; return conf.get("gameid"); } std::vector<WorldSpec> getAvailableWorlds() { std::vector<WorldSpec> worlds; std::set<std::string> worldspaths; worldspaths.insert(porting::path_user + DIR_DELIM + "worlds"); infostream<<"Searching worlds..."<<std::endl; for(std::set<std::string>::const_iterator i = worldspaths.begin(); i != worldspaths.end(); i++){ infostream<<" In "<<(*i)<<": "<<std::endl; std::vector<fs::DirListNode> dirvector = fs::GetDirListing(*i); for(u32 j=0; j<dirvector.size(); j++){ if(!dirvector[j].dir) continue; std::string fullpath = *i + DIR_DELIM + dirvector[j].name; std::string name = dirvector[j].name; // Just allow filling in the gameid always for now bool can_be_legacy = true; std::string gameid = getWorldGameId(fullpath, can_be_legacy); WorldSpec spec(fullpath, name, gameid); if(!spec.isValid()){ infostream<<"(invalid: "<<name<<") "; } else { infostream<<name<<" "; worlds.push_back(spec); } } infostream<<std::endl; } // Check old world location do{ std::string fullpath = porting::path_user + DIR_DELIM + "world"; if(!fs::PathExists(fullpath)) break; std::string name = "Old World"; std::string gameid = getWorldGameId(fullpath, true); WorldSpec spec(fullpath, name, gameid); infostream<<"Old world found."<<std::endl; worlds.push_back(spec); }while(0); infostream<<worlds.size()<<" found."<<std::endl; return worlds; } bool initializeWorld(const std::string &path, const std::string &gameid) { infostream<<"Initializing world at "<<path<<std::endl; // Create world.mt if does not already exist std::string worldmt_path = path + DIR_DELIM + "world.mt"; if(!fs::PathExists(worldmt_path)){ infostream<<"Creating world.mt ("<<worldmt_path<<")"<<std::endl; fs::CreateAllDirs(path); std::ofstream of(worldmt_path.c_str(), std::ios::binary); of<<"gameid = "<<gameid<<"\n"; } return true; }