mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Implement function inlining for menu legacy mode
This commit is contained in:
parent
9184c0265e
commit
4e5e6d05bd
@ -7,6 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "ObjWriting.h"
|
||||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||||
#include "Menu/MenuDumper.h"
|
#include "Menu/MenuDumper.h"
|
||||||
#include "Parsing/Impl/ParserInputStream.h"
|
#include "Parsing/Impl/ParserInputStream.h"
|
||||||
@ -509,6 +510,41 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteStatementOperandFunction(const Statement_s* statement, const size_t currentPos) const
|
||||||
|
{
|
||||||
|
const auto& operand = statement->entries[currentPos].data.operand;
|
||||||
|
|
||||||
|
if (operand.internals.function == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!ObjWriting::Configuration.MenuLegacyMode)
|
||||||
|
{
|
||||||
|
int functionIndex = -1;
|
||||||
|
if (statement->supportingData && statement->supportingData->uifunctions.functions)
|
||||||
|
{
|
||||||
|
for (auto supportingFunctionIndex = 0; supportingFunctionIndex < statement->supportingData->uifunctions.totalFunctions; supportingFunctionIndex++)
|
||||||
|
{
|
||||||
|
if (statement->supportingData->uifunctions.functions[supportingFunctionIndex] == operand.internals.function)
|
||||||
|
{
|
||||||
|
functionIndex = supportingFunctionIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (functionIndex >= 0)
|
||||||
|
m_stream << "FUNC_" << functionIndex;
|
||||||
|
else
|
||||||
|
m_stream << "INVALID_FUNC";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_stream << "(";
|
||||||
|
WriteStatementSkipInitialUnnecessaryParenthesis(operand.internals.function);
|
||||||
|
m_stream << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WriteStatementOperand(const Statement_s* statement, size_t& currentPos, bool& spaceNext) const
|
void WriteStatementOperand(const Statement_s* statement, size_t& currentPos, bool& spaceNext) const
|
||||||
{
|
{
|
||||||
const auto& expEntry = statement->entries[currentPos];
|
const auto& expEntry = statement->entries[currentPos];
|
||||||
@ -533,27 +569,8 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VAL_FUNCTION:
|
case VAL_FUNCTION:
|
||||||
{
|
WriteStatementOperandFunction(statement, currentPos);
|
||||||
int functionIndex = -1;
|
break;
|
||||||
if (statement->supportingData && statement->supportingData->uifunctions.functions)
|
|
||||||
{
|
|
||||||
for (auto supportingFunctionIndex = 0; supportingFunctionIndex < statement->supportingData->uifunctions.totalFunctions; supportingFunctionIndex++)
|
|
||||||
{
|
|
||||||
if (statement->supportingData->uifunctions.functions[supportingFunctionIndex] == operand.internals.function)
|
|
||||||
{
|
|
||||||
functionIndex = supportingFunctionIndex;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (functionIndex >= 0)
|
|
||||||
m_stream << "FUNC_" << functionIndex;
|
|
||||||
else
|
|
||||||
m_stream << "INVALID_FUNC";
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user