diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp index ef901b1f..8c36daba 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp @@ -53,7 +53,17 @@ bool AssetDumperMenuDef::ShouldDump(XAssetInfo* asset) void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo* asset) { const auto* menu = asset->Asset(); - const auto assetFile = context.OpenAssetFile(GetPathForMenu(asset)); + const auto menuFilePath = GetPathForMenu(asset); + + if(ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST)) + { + // Don't dump menu file separately if the name matches the menu list + const auto* menuListParent = GetParentMenuList(asset); + if (menuListParent && menuFilePath == menuListParent->name) + return; + } + + const auto assetFile = context.OpenAssetFile(menuFilePath); if (!assetFile) return; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp index c0161d34..9cc4f0f2 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp @@ -12,13 +12,6 @@ using namespace IW4; bool AssetDumperMenuList::ShouldDump(XAssetInfo* asset) { - const auto* menuList = asset->Asset(); - const fs::path p(asset->Asset()->name); - const auto extension = p.extension().string(); - - if (extension == ".menu" && menuList->menuCount == 1) - return false; - return true; } @@ -45,7 +38,14 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfowindow.name << ".menu"; - menuDumper.IncludeMenu(ss.str()); + + const auto menuName = ss.str(); + + // If the menu was embedded directly as menu list write its data in the menu list file + if(menuName == menuList->name) + menuDumper.WriteMenu(menu); + else + menuDumper.IncludeMenu(ss.str()); } menuDumper.End();