aboutsummaryrefslogtreecommitdiff
path: root/src/client
ModeNameSize
-rw-r--r--CMakeLists.txt2526logplain
-rw-r--r--activeobjectmgr.cpp2910logplain
-rw-r--r--activeobjectmgr.h1332logplain
-rw-r--r--camera.cpp23828logplain
-rw-r--r--camera.h6884logplain
-rw-r--r--client.cpp52984logplain
-rw-r--r--client.h18861logplain
-rw-r--r--clientenvironment.cpp13533logplain
-rw-r--r--clientenvironment.h4183logplain
-rw-r--r--clientevent.h2845logplain
-rw-r--r--clientlauncher.cpp18743logplain
-rw-r--r--clientlauncher.h1598logplain
-rw-r--r--clientmap.cpp28880logplain
-rw-r--r--clientmap.h5604logplain
-rw-r--r--clientmedia.cpp22833logplain
-rw-r--r--clientmedia.h7388logplain
-rw-r--r--clientobject.cpp1694logplain
-rw-r--r--clientobject.h3559logplain
-rw-r--r--clientsimpleobject.h1052logplain
-rw-r--r--clouds.cpp11506logplain
-rw-r--r--clouds.h3075logplain
-rw-r--r--content_cao.cpp59571logplain
-rw-r--r--content_cao.h7411logplain
-rw-r--r--content_cso.cpp2574logplain
-rw-r--r--content_cso.h982logplain
-rw-r--r--content_mapblock.cpp49238logplain
-rw-r--r--content_mapblock.h4911logplain
-rw-r--r--event_manager.h2257logplain
-rw-r--r--filecache.cpp2445logplain
-rw-r--r--filecache.h1355logplain
-rw-r--r--fontengine.cpp7774logplain
-rw-r--r--fontengine.h4643logplain
-rw-r--r--game.cpp128576logplain
-rw-r--r--game.h1434logplain
-rw-r--r--gameui.cpp10380logplain
-rw-r--r--gameui.h3903logplain
-rw-r--r--guiscalingfilter.cpp8159logplain
-rw-r--r--guiscalingfilter.h2455logplain
-rw-r--r--hud.cpp40324logplain
-rw-r--r--hud.h4638logplain
-rw-r--r--imagefilters.cpp7626logplain
-rw-r--r--imagefilters.h1948logplain
-rw-r--r--inputhandler.cpp8826logplain
-rw-r--r--inputhandler.h9790logplain
-rw-r--r--joystick_controller.cpp9734logplain
-rw-r--r--joystick_controller.h3782logplain
-rw-r--r--keycode.cpp10185logplain
-rw-r--r--keycode.h1776logplain
-rw-r--r--keys.h1941logplain
-rw-r--r--localplayer.cpp33595logplain
-rw-r--r--localplayer.h6477logplain
-rw-r--r--mapblock_mesh.cpp42875logplain
-rw-r--r--mapblock_mesh.h9330logplain
-rw-r--r--mesh.cpp15970logplain
-rw-r--r--mesh.h4022logplain
-rw-r--r--mesh_generator_thread.cpp8113logplain
-rw-r--r--mesh_generator_thread.h3355logplain
d---------meshgen80logplain
-rw-r--r--minimap.cpp21225logplain
-rw-r--r--minimap.h4620logplain
-rw-r--r--particles.cpp15966logplain
-rw-r--r--particles.h4695logplain
d---------render612logplain
-rw-r--r--renderingengine.cpp18766logplain
-rw-r--r--renderingengine.h3604logplain
-rw-r--r--shader.cpp25272logplain
-rw-r--r--shader.h4401logplain
d---------shadows394logplain
-rw-r--r--sky.cpp32420logplain
-rw-r--r--sky.h7972logplain
-rw-r--r--sound.cpp880logplain
-rw-r--r--sound.h3585logplain
-rw-r--r--sound_openal.cpp18555logplain
-rw-r--r--sound_openal.h1114logplain
-rw-r--r--tile.cpp66649logplain
-rw-r--r--tile.h9623logplain
-rw-r--r--wieldmesh.cpp24490logplain
-rw-r--r--wieldmesh.h4198logplain
lass="hl opt">(lua_State *L, std::string name,bool& valid) { lua_getglobal(L, "gamedata"); lua_getfield(L, -1, name.c_str()); if(lua_isnil(L, -1)) { valid = false; return false; } valid = true; return readParam<bool>(L, -1); } /******************************************************************************/ int ModApiMainMenu::l_update_formspec(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); if (engine->m_startgame) return 0; //read formspec std::string formspec(luaL_checkstring(L, 1)); if (engine->m_formspecgui != 0) { engine->m_formspecgui->setForm(formspec); } return 0; } /******************************************************************************/ int ModApiMainMenu::l_set_formspec_prepend(lua_State *L) { GUIEngine *engine = getGuiEngine(L); sanity_check(engine != NULL); if (engine->m_startgame) return 0; std::string formspec(luaL_checkstring(L, 1)); engine->setFormspecPrepend(formspec); return 0; } /******************************************************************************/ int ModApiMainMenu::l_start(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); //update c++ gamedata from lua table bool valid = false; MainMenuData *data = engine->m_data; data->selected_world = getIntegerData(L, "selected_world",valid) -1; data->simple_singleplayer_mode = getBoolData(L,"singleplayer",valid); data->do_reconnect = getBoolData(L, "do_reconnect", valid); if (!data->do_reconnect) { data->name = getTextData(L,"playername"); data->password = getTextData(L,"password"); data->address = getTextData(L,"address"); data->port = getTextData(L,"port"); } data->serverdescription = getTextData(L,"serverdescription"); data->servername = getTextData(L,"servername"); //close menu next time engine->m_startgame = true; return 0; } /******************************************************************************/ int ModApiMainMenu::l_close(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); engine->m_kill = true; return 0; } /******************************************************************************/ int ModApiMainMenu::l_set_background(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); std::string backgroundlevel(luaL_checkstring(L, 1)); std::string texturename(luaL_checkstring(L, 2)); bool tile_image = false; bool retval = false; unsigned int minsize = 16; if (!lua_isnone(L, 3)) { tile_image = readParam<bool>(L, 3); } if (!lua_isnone(L, 4)) { minsize = lua_tonumber(L, 4); } if (backgroundlevel == "background") { retval |= engine->setTexture(TEX_LAYER_BACKGROUND, texturename, tile_image, minsize); } if (backgroundlevel == "overlay") { retval |= engine->setTexture(TEX_LAYER_OVERLAY, texturename, tile_image, minsize); } if (backgroundlevel == "header") { retval |= engine->setTexture(TEX_LAYER_HEADER, texturename, tile_image, minsize); } if (backgroundlevel == "footer") { retval |= engine->setTexture(TEX_LAYER_FOOTER, texturename, tile_image, minsize); } lua_pushboolean(L,retval); return 1; } /******************************************************************************/ int ModApiMainMenu::l_set_clouds(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); bool value = readParam<bool>(L,1); engine->m_clouds_enabled = value; return 0; } /******************************************************************************/ int ModApiMainMenu::l_get_textlist_index(lua_State *L) { // get_table_index accepts both tables and textlists return l_get_table_index(L); } /******************************************************************************/ int ModApiMainMenu::l_get_table_index(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); std::string tablename(luaL_checkstring(L, 1)); GUITable *table = engine->m_menu->getTable(tablename); s32 selection = table ? table->getSelected() : 0; if (selection >= 1) lua_pushinteger(L, selection); else lua_pushnil(L); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_worlds(lua_State *L) { std::vector<WorldSpec> worlds = getAvailableWorlds(); lua_newtable(L); int top = lua_gettop(L); unsigned int index = 1; for (const WorldSpec &world : worlds) { lua_pushnumber(L,index); lua_newtable(L); int top_lvl2 = lua_gettop(L); lua_pushstring(L,"path"); lua_pushstring(L, world.path.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L,"name"); lua_pushstring(L, world.name.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L,"gameid"); lua_pushstring(L, world.gameid.c_str()); lua_settable(L, top_lvl2); lua_settable(L, top); index++; } return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_games(lua_State *L) { std::vector<SubgameSpec> games = getAvailableGames(); lua_newtable(L); int top = lua_gettop(L); unsigned int index = 1; for (const SubgameSpec &game : games) { lua_pushnumber(L, index); lua_newtable(L); int top_lvl2 = lua_gettop(L); lua_pushstring(L, "id"); lua_pushstring(L, game.id.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "path"); lua_pushstring(L, game.path.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "type"); lua_pushstring(L, "game"); lua_settable(L, top_lvl2); lua_pushstring(L, "gamemods_path"); lua_pushstring(L, game.gamemods_path.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "name"); lua_pushstring(L, game.name.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "author"); lua_pushstring(L, game.author.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "release"); lua_pushinteger(L, game.release); lua_settable(L, top_lvl2); lua_pushstring(L, "menuicon_path"); lua_pushstring(L, game.menuicon_path.c_str()); lua_settable(L, top_lvl2); lua_pushstring(L, "addon_mods_paths"); lua_newtable(L); int table2 = lua_gettop(L); int internal_index = 1; for (const std::string &addon_mods_path : game.addon_mods_paths) { lua_pushnumber(L, internal_index); lua_pushstring(L, addon_mods_path.c_str()); lua_settable(L, table2); internal_index++; } lua_settable(L, top_lvl2); lua_settable(L, top); index++; } return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_content_info(lua_State *L) { std::string path = luaL_checkstring(L, 1); ContentSpec spec; spec.path = path; parseContentInfo(spec); lua_newtable(L); lua_pushstring(L, spec.name.c_str()); lua_setfield(L, -2, "name"); lua_pushstring(L, spec.type.c_str()); lua_setfield(L, -2, "type"); lua_pushstring(L, spec.author.c_str()); lua_setfield(L, -2, "author"); lua_pushinteger(L, spec.release); lua_setfield(L, -2, "release"); lua_pushstring(L, spec.desc.c_str()); lua_setfield(L, -2, "description"); lua_pushstring(L, spec.path.c_str()); lua_setfield(L, -2, "path"); if (spec.type == "mod") { ModSpec spec; spec.path = path; parseModContents(spec); // Dependencies lua_newtable(L); int i = 1; for (const auto &dep : spec.depends) { lua_pushstring(L, dep.c_str()); lua_rawseti(L, -2, i++); } lua_setfield(L, -2, "depends"); // Optional Dependencies lua_newtable(L); i = 1; for (const auto &dep : spec.optdepends) { lua_pushstring(L, dep.c_str()); lua_rawseti(L, -2, i++); } lua_setfield(L, -2, "optional_depends"); } return 1; } /******************************************************************************/ int ModApiMainMenu::l_show_keys_menu(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu( engine->m_rendering_engine->get_gui_env(), engine->m_parent, -1, engine->m_menumanager, engine->m_texture_source); kmenu->drop(); return 0; } /******************************************************************************/ int ModApiMainMenu::l_create_world(lua_State *L) { const char *name = luaL_checkstring(L, 1); int gameidx = luaL_checkinteger(L,2) -1; std::string path = porting::path_user + DIR_DELIM "worlds" + DIR_DELIM + sanitizeDirName(name, "world_"); std::vector<SubgameSpec> games = getAvailableGames(); if ((gameidx >= 0) && (gameidx < (int) games.size())) { // Create world if it doesn't exist try { loadGameConfAndInitWorld(path, name, games[gameidx], true); lua_pushnil(L); } catch (const BaseException &e) { lua_pushstring(L, (std::string("Failed to initialize world: ") + e.what()).c_str()); } } else { lua_pushstring(L, "Invalid game index"); } return 1; } /******************************************************************************/ int ModApiMainMenu::l_delete_world(lua_State *L) { int world_id = luaL_checkinteger(L, 1) - 1; std::vector<WorldSpec> worlds = getAvailableWorlds(); if (world_id < 0 || world_id >= (int) worlds.size()) { lua_pushstring(L, "Invalid world index"); return 1; } const WorldSpec &spec = worlds[world_id]; if (!fs::RecursiveDelete(spec.path)) { lua_pushstring(L, "Failed to delete world"); return 1; } return 0; } /******************************************************************************/ int ModApiMainMenu::l_set_topleft_text(lua_State *L) { GUIEngine* engine = getGuiEngine(L); sanity_check(engine != NULL); std::string text; if (!lua_isnone(L,1) && !lua_isnil(L,1)) text = luaL_checkstring(L, 1); engine->setTopleftText(text); return 0; } /******************************************************************************/ int ModApiMainMenu::l_get_mapgen_names(lua_State *L) { std::vector<const char *> names; bool include_hidden = lua_isboolean(L, 1) && readParam<bool>(L, 1); Mapgen::getMapgenNames(&names, include_hidden); lua_newtable(L); for (size_t i = 0; i != names.size(); i++) { lua_pushstring(L, names[i]); lua_rawseti(L, -2, i + 1); } return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_user_path(lua_State *L) { std::string path = fs::RemoveRelativePathComponents(porting::path_user); lua_pushstring(L, path.c_str()); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_modpath(lua_State *L) { std::string modpath = fs::RemoveRelativePathComponents( porting::path_user + DIR_DELIM + "mods" + DIR_DELIM); lua_pushstring(L, modpath.c_str()); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_clientmodpath(lua_State *L) { std::string modpath = fs::RemoveRelativePathComponents( porting::path_user + DIR_DELIM + "clientmods" + DIR_DELIM); lua_pushstring(L, modpath.c_str()); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_gamepath(lua_State *L) { std::string gamepath = fs::RemoveRelativePathComponents( porting::path_user + DIR_DELIM + "games" + DIR_DELIM); lua_pushstring(L, gamepath.c_str()); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_texturepath(lua_State *L) { std::string gamepath = fs::RemoveRelativePathComponents( porting::path_user + DIR_DELIM + "textures"); lua_pushstring(L, gamepath.c_str()); return 1; } /******************************************************************************/ int ModApiMainMenu::l_get_texturepath_share(lua_State *L) { std::string gamepath = fs::RemoveRelativePathComponents( porting::path_share + DIR_DELIM + "textures");