Fix not dumping enableDvar correctly

This commit is contained in:
Jan 2021-11-01 17:19:17 +01:00
parent 99ca6f8efb
commit b0a9406f96
2 changed files with 34 additions and 8 deletions

View File

@ -492,6 +492,31 @@ void MenuDumper::WriteFloatExpressionsProperty(const ItemFloatExpression* floatE
}
}
void MenuDumper::WriteMultiTokenStringProperty(const std::string& propertyKey, const char* value) const
{
if (!value)
return;
Indent();
WriteKey(propertyKey);
const auto tokenList = CreateScriptTokenList(value);
auto firstToken = true;
m_stream << "{ ";
for (const auto& token : tokenList)
{
if (firstToken)
firstToken = false;
else
m_stream << ";";
m_stream << "\"" << token << "\"";
}
if (!firstToken)
m_stream << " ";
m_stream << "}\n";
}
void MenuDumper::WriteColumnProperty(const std::string& propertyKey, const listBoxDef_s* listBox) const
{
if (listBox->numColumns <= 0)
@ -658,7 +683,8 @@ void MenuDumper::WriteItemData(const itemDef_s* item)
WriteFloatProperty("borderSize", item->window.borderSize, 0.0f);
WriteStatementProperty("visible", item->visibleExp, true);
WriteStatementProperty("disabled", item->disabledExp, true);
WriteIntProperty("ownerDraw", item->window.ownerDraw, 0);
WriteIntProperty("ownerdraw", item->window.ownerDraw, 0);
WriteFlagsProperty("ownerdrawFlag", item->window.ownerDrawFlags);
WriteIntProperty("align", item->alignment, 0);
WriteIntProperty("textalign", item->textAlignMode, 0);
WriteFloatProperty("textalignx", item->textalignx, 0.0f);
@ -683,19 +709,18 @@ void MenuDumper::WriteItemData(const itemDef_s* item)
WriteMenuEventHandlerSetProperty("accept", item->accept);
// WriteFloatProperty("special", item->special, 0.0f);
WriteSoundAliasProperty("focusSound", item->focusSound);
WriteFlagsProperty("ownerdrawFlag", item->window.ownerDrawFlags);
WriteStringProperty("dvarTest", item->dvarTest);
if (item->dvarFlags & ITEM_DVAR_FLAG_ENABLE)
WriteStringProperty("enableDvar", item->enableDvar);
WriteMultiTokenStringProperty("enableDvar", item->enableDvar);
else if (item->dvarFlags & ITEM_DVAR_FLAG_DISABLE)
WriteStringProperty("disableDvar", item->enableDvar);
WriteMultiTokenStringProperty("disableDvar", item->enableDvar);
else if (item->dvarFlags & ITEM_DVAR_FLAG_SHOW)
WriteStringProperty("showDvar", item->enableDvar);
WriteMultiTokenStringProperty("showDvar", item->enableDvar);
else if (item->dvarFlags & ITEM_DVAR_FLAG_HIDE)
WriteStringProperty("hideDvar", item->enableDvar);
WriteMultiTokenStringProperty("hideDvar", item->enableDvar);
else if (item->dvarFlags & ITEM_DVAR_FLAG_FOCUS)
WriteStringProperty("focusDvar", item->enableDvar);
WriteMultiTokenStringProperty("focusDvar", item->enableDvar);
WriteItemKeyHandlerProperty(item->onKey);
WriteStatementProperty("exp text", item->textExp, false);

View File

@ -29,6 +29,7 @@ namespace IW4
void WriteSoundAliasProperty(const std::string& propertyKey, const snd_alias_list_t* soundAliasValue) const;
void WriteDecodeEffectProperty(const std::string& propertyKey, const itemDef_s* item) const;
void WriteItemKeyHandlerProperty(const ItemKeyHandler* itemKeyHandlerValue);
void WriteMultiTokenStringProperty(const std::string& propertyKey, const char* value) const;
void WriteFloatExpressionsProperty(const ItemFloatExpression* floatExpressions, int floatExpressionCount) const;
void WriteColumnProperty(const std::string& propertyKey, const listBoxDef_s* listBox) const;