diff --git a/src/cli/Main.cpp b/src/cli/Main.cpp index 96eae74..cf28998 100644 --- a/src/cli/Main.cpp +++ b/src/cli/Main.cpp @@ -322,6 +322,8 @@ void pack(const argparse::ArgumentParser& cli, const std::string& inputPath) { if (auto* vpk = dynamic_cast(packFile.get())) { vpk->setChunkSize(preferredChunkSize); } + } else if (type == "wad3") { + packFile = WAD3::create(outputPath); } if (!packFile) { std::cerr << "Failed to create pack file!" << std::endl; @@ -412,7 +414,7 @@ int main(int argc, const char* const* argv) { cli.add_argument(ARG_P(TYPE)) .help("(Pack) The type of the output pack file.") .default_value("vpk") - .choices("bmz", "fpx", "pak", "pck", "vpk_vtmb", "vpk", "zip") + .choices("bmz", "fpx", "pak", "pck", "vpk_vtmb", "vpk", "wad3", "zip") .nargs(1); cli.add_argument(ARG_L(NO_PROGRESS)) diff --git a/src/gui/Window.cpp b/src/gui/Window.cpp index 941a804..e8200c6 100644 --- a/src/gui/Window.cpp +++ b/src/gui/Window.cpp @@ -88,6 +88,9 @@ Window::Window(QWidget* parent) this->createEmptyMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "VPK", [this] { this->newVPK(false); }); + this->createEmptyMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "WAD3", [this] { + this->newWAD3(false); + }); this->createEmptyMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "ZIP", [this] { this->newZIP(false); }); @@ -108,6 +111,9 @@ Window::Window(QWidget* parent) this->createFromDirMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "VPK", [this] { this->newVPK(true); }); + this->createFromDirMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "WAD3", [this] { + this->newWAD3(true); + }); this->createFromDirMenu->addAction(this->style()->standardIcon(QStyle::SP_FileIcon), "ZIP", [this] { this->newZIP(true); }); @@ -468,7 +474,7 @@ Window::Window(QWidget* parent) template void newPackFile(Window* window, bool fromDirectory, const QString& startPath, const QString& name, const QString& extension) { - static_assert(Type == PackFileType::FPX || Type == PackFileType::PAK || Type == PackFileType::PCK || Type == PackFileType::VPK || Type == PackFileType::ZIP); + static_assert(Type == PackFileType::FPX || Type == PackFileType::PAK || Type == PackFileType::PCK || Type == PackFileType::VPK || Type == PackFileType::WAD3 || Type == PackFileType::ZIP); if (window->isModified() && window->promptUserToKeepModifications()) { return; @@ -514,6 +520,8 @@ void newPackFile(Window* window, bool fromDirectory, const QString& startPath, c if (auto* vpk = dynamic_cast(packFile.get())) { vpk->setChunkSize(options->vpk_chunkSize); } + } else if constexpr (Type == PackFileType::WAD3) { + packFile = WAD3::create(packFilePath.toLocal8Bit().constData()); } else if constexpr (Type == PackFileType::ZIP) { packFile = ZIP::create(packFilePath.toLocal8Bit().constData()); } else { @@ -605,6 +613,10 @@ void Window::newVPK(bool fromDirectory, const QString& startPath) { return ::newPackFile(this, fromDirectory, startPath, "VPK", ".vpk"); } +void Window::newWAD3(bool fromDirectory, const QString& startPath) { + return ::newPackFile(this, fromDirectory, startPath, "WAD3", ".wad"); +} + void Window::newZIP(bool fromDirectory, const QString& startPath) { return ::newPackFile(this, fromDirectory, startPath, "ZIP", ".zip"); } diff --git a/src/gui/Window.h b/src/gui/Window.h index 182d1c3..8604d58 100644 --- a/src/gui/Window.h +++ b/src/gui/Window.h @@ -44,6 +44,8 @@ class Window : public QMainWindow { void newVPK(bool fromDirectory, const QString& startPath = QString()); + void newWAD3(bool fromDirectory, const QString& startPath = QString()); + void newZIP(bool fromDirectory, const QString& startPath = QString()); void openDir(const QString& startPath = QString(), const QString& dirPath = QString()); diff --git a/src/gui/previews/MDLPreview.cpp b/src/gui/previews/MDLPreview.cpp index b3c0909..db3fd4d 100644 --- a/src/gui/previews/MDLPreview.cpp +++ b/src/gui/previews/MDLPreview.cpp @@ -562,10 +562,14 @@ void MDLPreview::setMesh(const QString& path, PackFile& packFile) const { if (!mdlData || !vvdData || !vtxData) { QString error{tr("Unable to find all the required files the model is composed of!") + '\n'}; if (!mdlData) { - error += "\n- " + basePath + ".mdl"; + error += "\n- "; + error += basePath.c_str(); + error += ".mdl"; } if (!vvdData) { - error += "\n- " + basePath + ".vvd"; + error += "\n- "; + error += basePath.c_str(); + error += ".vvd"; } if (!vtxData) { error += "\n- " + tr("One of the following:") + diff --git a/src/shared/thirdparty/sourcepp b/src/shared/thirdparty/sourcepp index 324b526..e5046a2 160000 --- a/src/shared/thirdparty/sourcepp +++ b/src/shared/thirdparty/sourcepp @@ -1 +1 @@ -Subproject commit 324b52639fb3671d3cc8be2640bb6688f15106d1 +Subproject commit e5046a202d9f1c2e6fc5a4adb0f90c528399d71c