diff --git a/src/editor/BspRenderer.cpp b/src/editor/BspRenderer.cpp index 7e8827e0..463442d4 100644 --- a/src/editor/BspRenderer.cpp +++ b/src/editor/BspRenderer.cpp @@ -1284,10 +1284,10 @@ int BspRenderer::refreshModel(int modelIdx, bool refreshClipnodes, bool triangul { std::vector cleanupWireframe = removeDuplicateWireframeLines(wireframeVerts_full); +#ifdef _DEBUG if (g_verbose) print_log("Optimize wireframe {} model: {} to {} lines.\n", modelIdx, wireframeVerts_full.size(), cleanupWireframe.size()); - - +#endif cVert* resultWireFrame = new cVert[cleanupWireframe.size()]; memcpy(resultWireFrame, cleanupWireframe.data(), cleanupWireframe.size() * sizeof(cVert)); diff --git a/src/editor/Gui.cpp b/src/editor/Gui.cpp index b35f40a7..54ff1925 100644 --- a/src/editor/Gui.cpp +++ b/src/editor/Gui.cpp @@ -807,6 +807,14 @@ void ExportModel(Bsp* src_map, int model_id, int ExportType, bool movemodel) bspModel->bsp_header.nVersion = 30; } + //if (src_entId >= 0) + //{ + // if (src_map->ents[src_entId]->classname == "func_water") + // { + // bspModel->models[0].vOrigin = getCenter(bspModel->models[0].nMins, bspModel->models[0].nMaxs); + // } + //} + bspModel->bsp_path = g_working_dir + src_map->bsp_name + "_model" + std::to_string(model_id) + ".bsp"; bspModel->write(bspModel->bsp_path); removeFile(bspModel->bsp_path); @@ -815,10 +823,6 @@ void ExportModel(Bsp* src_map, int model_id, int ExportType, bool movemodel) memset(tmpCompressed, 0xFF, MAX_MAP_LEAVES / 8); /* if something bad */ - while (bspModel->models[newModelIdx].nVisLeafs >= bspModel->leafCount) - { - bspModel->create_leaf_back(CONTENTS_SOLID); - } bspModel->models[newModelIdx].nVisLeafs = bspModel->leafCount - 1; // ADD LEAFS TO ALL VISIBILITY BYTES @@ -3130,7 +3134,7 @@ void Gui::drawMenuBar() tmpSize += 8; } - if (ImGui::MenuItem((std::to_string(tmpSize) + " units###2").c_str(), NULL, cell_size == tmpSize)) + if (ImGui::MenuItem((std::to_string(tmpSize) + " units###" + std::to_string(tmpSize)).c_str(), NULL, cell_size == tmpSize)) { cell_size = tmpSize; } @@ -3204,6 +3208,10 @@ void Gui::drawMenuBar() if (hull_for_export >= 0) { print_log("Start exporting to UnrealMapDrawTool....\n"); + + + mapFixLightEnts(map); + rend->pushModelUndoState("Create lights", FL_ENTITIES); FlushConsoleLog(); vec3 mins{}, maxs{}; /*map->get_bounding_box(mins, maxs);*/ @@ -3595,66 +3603,70 @@ void Gui::drawMenuBar() } } + } - if (umdTextures.empty()) - { - umdTextures.push_back("SKY"); - } - std::ofstream tmpmap("exported.umd", std::ios::out | std::ios::binary); - if (tmpmap.is_open()) { - tmpmap.write(reinterpret_cast(&UMD_MAGIC), 4); + if (umdTextures.empty()) + { + umdTextures.push_back("SKY"); + } + createDir(g_working_dir); - int zero = 0; - tmpmap.write(reinterpret_cast(&zero), 4); - tmpmap.write(reinterpret_cast(&zero), 4); - tmpmap.write(reinterpret_cast(&zero), 4); - tmpmap.write(reinterpret_cast(&zero), 4); + std::ofstream tmpmap(g_working_dir + "exported.umd", std::ios::out | std::ios::binary); - tmpmap.write(reinterpret_cast(&cell_x), 4); - tmpmap.write(reinterpret_cast(&cell_y), 4); - tmpmap.write(reinterpret_cast(&cell_size), 4); - tmpmap.write(reinterpret_cast(&cell_size), 4); - tmpmap.write(reinterpret_cast(&cell_levels), 4); - tmpmap.write(reinterpret_cast(&cell_layers), 4); + print_log("\nSaved .umd map to {} path\n", g_working_dir + "exported.umd"); - for (const auto& tmpcell : cell_list) - { - tmpmap.write(reinterpret_cast(&tmpcell.height), 1); - tmpmap.write(reinterpret_cast(&tmpcell.height_offset), 1); - tmpmap.write(reinterpret_cast(&tmpcell.texid), 1); - tmpmap.write(reinterpret_cast(&tmpcell.type), 1); - } + if (tmpmap.is_open()) { + tmpmap.write(reinterpret_cast(&UMD_MAGIC), 4); - int skybool = 0; - tmpmap.write(reinterpret_cast(&skybool), 4); + int zero = 0; + tmpmap.write(reinterpret_cast(&zero), 4); + tmpmap.write(reinterpret_cast(&zero), 4); + tmpmap.write(reinterpret_cast(&zero), 4); + tmpmap.write(reinterpret_cast(&zero), 4); - unsigned int options = 0; - if (texture_support) - { - options |= umd_flags::UMD_TEXTURES_SKIP_OPTIMIZE; - } - if (NO_OPTIMIZE) - { - options |= umd_flags::UMD_OPTIMIZE_DISABLED; - } + tmpmap.write(reinterpret_cast(&cell_x), 4); + tmpmap.write(reinterpret_cast(&cell_y), 4); + tmpmap.write(reinterpret_cast(&cell_size), 4); + tmpmap.write(reinterpret_cast(&cell_size), 4); + tmpmap.write(reinterpret_cast(&cell_levels), 4); + tmpmap.write(reinterpret_cast(&cell_layers), 4); - tmpmap.write(reinterpret_cast(&options), 4); + for (const auto& tmpcell : cell_list) + { + tmpmap.write(reinterpret_cast(&tmpcell.height), 1); + tmpmap.write(reinterpret_cast(&tmpcell.height_offset), 1); + tmpmap.write(reinterpret_cast(&tmpcell.texid), 1); + tmpmap.write(reinterpret_cast(&tmpcell.type), 1); + } - // textures - int textureCount = (int)umdTextures.size(); - tmpmap.write(reinterpret_cast(&textureCount), 4); + int skybool = 0; + tmpmap.write(reinterpret_cast(&skybool), 4); - for (const auto& texture : umdTextures) { - int length = (int)texture.length(); - tmpmap.write(reinterpret_cast(&length), 4); - tmpmap.write(texture.c_str(), length); - } + unsigned int options = 0; + if (texture_support) + { + options |= umd_flags::UMD_TEXTURES_SKIP_OPTIMIZE; + } + if (NO_OPTIMIZE) + { + options |= umd_flags::UMD_OPTIMIZE_DISABLED; + } + + tmpmap.write(reinterpret_cast(&options), 4); - tmpmap.close(); + // textures + int textureCount = (int)umdTextures.size(); + tmpmap.write(reinterpret_cast(&textureCount), 4); + + for (const auto& texture : umdTextures) { + int length = (int)texture.length(); + tmpmap.write(reinterpret_cast(&length), 4); + tmpmap.write(texture.c_str(), length); } - } + tmpmap.close(); + } print_log("Success! Pos debug mins/maxs {},{},{} / {},{},{}!\n", pos_debug_mins.x, pos_debug_mins.y, pos_debug_mins.z, pos_debug_maxs.x, pos_debug_maxs.y, pos_debug_maxs.z); @@ -5197,105 +5209,7 @@ void Gui::drawMenuBar() if (ImGui::MenuItem("Fix light entities")) { - std::vector modelLeafs; - map->modelLeafs(0, modelLeafs); - - std::vector ignore_mins; - std::vector ignore_maxs; - - std::vector add_leafs; - std::vector add_leafs_power; - - for (auto i : modelLeafs) - { - if (map->leaves[i].nContents == CONTENTS_EMPTY) - { - if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 250.0 && - (map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() < 1000.0f) - { - bool skip = false; - for (size_t v = 0; v < ignore_maxs.size(); v++) - { - if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) - { - skip = true; - break; - } - } - if (!skip) - { - ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); - ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); - add_leafs.push_back(i); - add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); - } - } - } - } - - for (auto i : modelLeafs) - { - if (map->leaves[i].nContents == CONTENTS_EMPTY) - { - if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 250.0) - { - bool skip = false; - for (size_t v = 0; v < ignore_maxs.size(); v++) - { - if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) - { - skip = true; - break; - } - } - if (!skip) - { - ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); - ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); - add_leafs.push_back(i); - add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); - } - } - } - } - for (auto i : modelLeafs) - { - if (map->leaves[i].nContents == CONTENTS_EMPTY) - { - if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 175.0) - { - bool skip = false; - for (size_t v = 0; v < ignore_maxs.size(); v++) - { - if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) - { - skip = true; - break; - } - } - if (!skip) - { - ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); - ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); - add_leafs.push_back(i); - add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); - } - } - } - } - - - - for (size_t i = 0; i < add_leafs.size(); i++) - { - map->ents.push_back(new Entity("light")); - vec3 lightPlace = getCenter(map->leaves[add_leafs[i]].nMaxs, map->leaves[add_leafs[i]].nMins); - lightPlace.z = std::max(map->leaves[i].nMins.z, map->leaves[i].nMaxs.z) - 16.0f; - map->ents[map->ents.size() - 1]->setOrAddKeyvalue("origin", getCenter(map->leaves[add_leafs[i]].nMaxs, map->leaves[add_leafs[i]].nMins).toKeyvalueString()); - map->ents[map->ents.size() - 1]->setOrAddKeyvalue("_light", vec4(255.0f, 255.0f, 255.0f, std::min(300.0f, add_leafs_power[i] * 0.5f)).toKeyvalueString(true)); - } - - map->update_ent_lump(); + mapFixLightEnts(map); g_app->updateEnts(); } if (ImGui::IsItemHovered() && g.HoveredIdTimer > g_tooltip_delay) @@ -6784,6 +6698,7 @@ void Gui::drawTextureBrowser() clipper.End(); ImGui::EndTabItem(); } + if (ImGui::BeginTabItem(get_localized_string(LANG_0653).c_str())) { ImGui::Dummy(ImVec2(0, 10)); diff --git a/src/editor/Renderer.cpp b/src/editor/Renderer.cpp index 93125155..2db89408 100644 --- a/src/editor/Renderer.cpp +++ b/src/editor/Renderer.cpp @@ -3907,6 +3907,8 @@ void Renderer::pasteEnt(bool noModifyOrigin) return; } + clearSelection(); + selectMap(map); vec3 baseOrigin = getEntOrigin(map, copiedEnts[0]); for (size_t i = 0; i < copiedEnts.size(); i++) @@ -3932,11 +3934,8 @@ void Renderer::pasteEnt(bool noModifyOrigin) CreateEntityCommand* createCommand = new CreateEntityCommand("Paste Entity", getSelectedMapId(), copiedEnts[i]); map->getBspRender()->pushUndoCommand(createCommand); + selectEnt(map, map->ents.size() > 1 ? ((int)map->ents.size() - 1) : 0, true); } - - clearSelection(); - selectMap(map); - selectEnt(map, map->ents.size() > 1 ? ((int)map->ents.size() - 1) : 0); } void Renderer::deleteEnt(int entIdx) diff --git a/src/util/util.cpp b/src/util/util.cpp index 5ceacb88..85aa68d2 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -34,7 +34,7 @@ std::mutex g_mutex_list[10] = {}; bool fileExists(const std::string& fileName) { std::error_code err; - return fs::exists(fileName,err) && !fs::is_directory(fileName); + return fs::exists(fileName, err) && !fs::is_directory(fileName); } char* loadFile(const std::string& fileName, int& length) @@ -81,7 +81,7 @@ bool writeFile(const std::string& fileName, const std::string& data) bool removeFile(const std::string& fileName) { std::error_code err; - return fs::exists(fileName,err) && fs::remove(fileName); + return fs::exists(fileName, err) && fs::remove(fileName); } bool copyFile(const std::string& from, const std::string& to) @@ -442,32 +442,32 @@ float getDistAlongAxis(const vec3& axis, const vec3& p) bool getPlaneFromVerts(const std::vector& verts, vec3& outNormal, float& outDist) { - const float tolerance = 0.00001f; + const float tolerance = 0.00001f; - size_t numVerts = verts.size(); - for (size_t i = 0; i < numVerts; ++i) - { - const vec3& v0 = verts[i]; - const vec3& v1 = verts[(i + 1) % numVerts]; - const vec3& v2 = verts[(i + 2) % numVerts]; + size_t numVerts = verts.size(); + for (size_t i = 0; i < numVerts; ++i) + { + const vec3& v0 = verts[i]; + const vec3& v1 = verts[(i + 1) % numVerts]; + const vec3& v2 = verts[(i + 2) % numVerts]; - vec3 ba = v1 - v0; - vec3 cb = v2 - v1; + vec3 ba = v1 - v0; + vec3 cb = v2 - v1; - vec3 normal = ba.cross(cb).normalize(); + vec3 normal = ba.cross(cb).normalize(); - if (i == 0) - { - outNormal = normal; - } - else if (std::abs(outNormal.dot(normal)) < 1.0f - tolerance) - { - return false; - } - } + if (i == 0) + { + outNormal = normal; + } + else if (std::abs(outNormal.dot(normal)) < 1.0f - tolerance) + { + return false; + } + } - outDist = getDistAlongAxis(outNormal, verts[0]); - return true; + outDist = getDistAlongAxis(outNormal, verts[0]); + return true; } vec3 findBestBrushCenter(std::vector& points) @@ -1002,7 +1002,7 @@ void WriteBMP_RGB(const std::string& fileName, unsigned char* pixels_rgb, int wi fclose(outputFile); } -void WriteBMP_PAL(const std::string& fileName, unsigned char* pixels_indexes, int width, int height, COLOR3 * pal) +void WriteBMP_PAL(const std::string& fileName, unsigned char* pixels_indexes, int width, int height, COLOR3* pal) { FILE* outputFile = NULL; fopen_s(&outputFile, fileName.c_str(), "wb"); @@ -1046,7 +1046,7 @@ void WriteBMP_PAL(const std::string& fileName, unsigned char* pixels_indexes, in fwrite(&colorsUsed, 4, 1, outputFile); int importantColors = ALL_COLORS_REQUIRED; fwrite(&importantColors, 4, 1, outputFile); - + COLOR4 pal4[256]; for (int i = 0; i < 256; i++) { @@ -1075,7 +1075,7 @@ int ArrayXYtoId(int w, int x, int y) bool dirExists(const std::string& dirName) { std::error_code err; - return fs::exists(dirName,err) && fs::is_directory(dirName); + return fs::exists(dirName, err) && fs::is_directory(dirName); } #ifndef WIN32 @@ -1170,16 +1170,19 @@ void removeDir(const std::string& dirName) } -void replaceAll(std::string& str, const std::string& from, const std::string& to) +bool replaceAll(std::string& str, const std::string& from, const std::string& to) { if (from.empty()) - return; + return false; size_t start_pos = 0; + bool found = false; while ((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); + found = true; } + return found; } void fixupPath(char* path, FIXUPPATH_SLASH startslash, FIXUPPATH_SLASH endslash) { @@ -1192,22 +1195,29 @@ void fixupPath(std::string& path, FIXUPPATH_SLASH startslash, FIXUPPATH_SLASH en { if (path.empty()) return; - replaceAll(path, "\"", ""); - replaceAll(path, "\'", ""); - replaceAll(path, "/", "\\"); - replaceAll(path, "\\\\", "\\"); - replaceAll(path, "\\", "/"); - replaceAll(path, "//", "/"); + + if (path.back() == '\"') + { + path.pop_back(); + if (!path.empty() && path.front() == '\"') + { + path.erase(path.begin()); + } + } + + while (replaceAll(path, "\\", "/")) {}; + while (replaceAll(path, "//", "/")) {}; + if (startslash == FIXUPPATH_SLASH::FIXUPPATH_SLASH_CREATE) { - if (path[0] != '\\' && path[0] != '/') + if (path[0] != '/') { path = "/" + path; } } else if (startslash == FIXUPPATH_SLASH::FIXUPPATH_SLASH_REMOVE) { - if (path[0] == '\\' || path[0] == '/') + if (path[0] == '/') { path.erase(path.begin()); } @@ -1215,26 +1225,20 @@ void fixupPath(std::string& path, FIXUPPATH_SLASH startslash, FIXUPPATH_SLASH en if (endslash == FIXUPPATH_SLASH::FIXUPPATH_SLASH_CREATE) { - if (path.empty() || (path.back() != '\\' && path.back() != '/')) + if (path.empty() || (path.back() != '/')) { path = path + "/"; } } else if (endslash == FIXUPPATH_SLASH::FIXUPPATH_SLASH_REMOVE) { - if (path.empty()) - return; - - if (path.back() == '\\' || path.back() == '/') + if (path.empty() && path.back() == '/') { path.pop_back(); } } - replaceAll(path, "/", "\\"); - replaceAll(path, "\\\\", "\\"); - replaceAll(path, "\\", "/"); - replaceAll(path, "//", "/"); + while (replaceAll(path, "//", "/")) {}; } float AngleFromTextureAxis(vec3 axis, bool x, int type) @@ -1338,7 +1342,7 @@ vec3 AxisFromTextureAngle(float angle, bool x, int type) } // For issue when string.size > 0 but string length is zero ("\0\0\0" string for example) -size_t nullstrlen(const std::string & str) +size_t nullstrlen(const std::string& str) { return strlen(str.c_str()); } @@ -1824,15 +1828,15 @@ std::string GetExecutableDirInternal(std::string arg_0_dir) #endif } return retdir; -} + } -std::string GetExecutableDir(const std::string & arg_0) +std::string GetExecutableDir(const std::string& arg_0) { fs::path retpath = arg_0.size() ? fs::path(arg_0) : fs::current_path(); return GetExecutableDirInternal(retpath.string()); } -std::string GetExecutableDir(const std::wstring & arg_0) +std::string GetExecutableDir(const std::wstring& arg_0) { fs::path retpath = arg_0.size() ? fs::path(arg_0) : fs::current_path(); return GetExecutableDirInternal(retpath.string()); @@ -2815,4 +2819,108 @@ extern "C" uint64_t _dtoul3_legacy(const double x) { return result; } -#endif \ No newline at end of file +#endif + + +void mapFixLightEnts(Bsp* map) +{ + std::vector modelLeafs; + map->modelLeafs(0, modelLeafs); + + std::vector ignore_mins; + std::vector ignore_maxs; + + std::vector add_leafs; + std::vector add_leafs_power; + + for (auto i : modelLeafs) + { + if (map->leaves[i].nContents == CONTENTS_EMPTY) + { + if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 250.0 && + (map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() < 1000.0f) + { + bool skip = false; + for (size_t v = 0; v < ignore_maxs.size(); v++) + { + if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) + { + skip = true; + break; + } + } + if (!skip) + { + ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); + ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); + add_leafs.push_back(i); + add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); + } + } + } + } + + for (auto i : modelLeafs) + { + if (map->leaves[i].nContents == CONTENTS_EMPTY) + { + if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 250.0) + { + bool skip = false; + for (size_t v = 0; v < ignore_maxs.size(); v++) + { + if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) + { + skip = true; + break; + } + } + if (!skip) + { + ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); + ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); + add_leafs.push_back(i); + add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); + } + } + } + } + for (auto i : modelLeafs) + { + if (map->leaves[i].nContents == CONTENTS_EMPTY) + { + if ((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test() > 175.0) + { + bool skip = false; + for (size_t v = 0; v < ignore_maxs.size(); v++) + { + if (checkCollision(map->leaves[i].nMins, map->leaves[i].nMaxs, ignore_mins[v], ignore_maxs[v])) + { + skip = true; + break; + } + } + if (!skip) + { + ignore_mins.push_back(map->leaves[i].nMins + vec3(-1.0f, -1.0f, -1.0f)); + ignore_maxs.push_back(map->leaves[i].nMaxs + vec3(1.0f, 1.0f, 1.0f)); + add_leafs.push_back(i); + add_leafs_power.push_back((map->leaves[i].nMaxs - map->leaves[i].nMins).abs().size_test()); + } + } + } + } + + + + for (size_t i = 0; i < add_leafs.size(); i++) + { + map->ents.push_back(new Entity("light")); + vec3 lightPlace = getCenter(map->leaves[add_leafs[i]].nMaxs, map->leaves[add_leafs[i]].nMins); + lightPlace.z = std::max(map->leaves[i].nMins.z, map->leaves[i].nMaxs.z) - 16.0f; + map->ents[map->ents.size() - 1]->setOrAddKeyvalue("origin", getCenter(map->leaves[add_leafs[i]].nMaxs, map->leaves[add_leafs[i]].nMins).toKeyvalueString()); + map->ents[map->ents.size() - 1]->setOrAddKeyvalue("_light", vec4(255.0f, 255.0f, 255.0f, std::min(300.0f, add_leafs_power[i] * 0.5f)).toKeyvalueString(true)); + } + + map->update_ent_lump(); +} \ No newline at end of file diff --git a/src/util/util.h b/src/util/util.h index 5dc994cb..7af38329 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -24,7 +24,7 @@ extern std::string g_version_string; extern std::mutex g_mutex_list[10]; #ifndef WIN32 -#define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename), (mode)))==NULL +#define fopen_s(pFile, filename, mode) (*(pFile) = fopen((filename), (mode)), (*(pFile) != NULL ? 0 : errno)) #endif static const vec3 s_baseaxis[18] = { @@ -43,7 +43,7 @@ extern ProgressMeter g_progress; std::vector splitStringIgnoringQuotes(const std::string& s, const std::string& delimitter); std::vector splitString(const std::string& s, const std::string& delimiter, int maxParts = 0); -void replaceAll(std::string& str, const std::string& from, const std::string& to); +bool replaceAll(std::string& str, const std::string& from, const std::string& to); bool fileExists(const std::string& fileName); @@ -271,4 +271,5 @@ bool ends_with(const std::wstring& str, const std::wstring& suffix); bool starts_with(const std::string& str, char prefix); bool starts_with(const std::wstring& str, wchar_t prefix); bool ends_with(const std::string& str, char suffix); -bool ends_with(const std::wstring& str, wchar_t suffix); \ No newline at end of file +bool ends_with(const std::wstring& str, wchar_t suffix); +void mapFixLightEnts(Bsp* map); \ No newline at end of file