mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
Dump menu float expressions
This commit is contained in:
parent
0f7a8ca1c9
commit
96774b96ba
@ -1206,6 +1206,38 @@ namespace IW4
|
|||||||
int endTriggerType;
|
int endTriggerType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ItemFloatExpressionTarget
|
||||||
|
{
|
||||||
|
ITEM_FLOATEXP_TGT_RECT_X = 0x0,
|
||||||
|
ITEM_FLOATEXP_TGT_RECT_Y = 0x1,
|
||||||
|
ITEM_FLOATEXP_TGT_RECT_W = 0x2,
|
||||||
|
ITEM_FLOATEXP_TGT_RECT_H = 0x3,
|
||||||
|
ITEM_FLOATEXP_TGT_FORECOLOR_R = 0x4,
|
||||||
|
ITEM_FLOATEXP_TGT_FORECOLOR_G = 0x5,
|
||||||
|
ITEM_FLOATEXP_TGT_FORECOLOR_B = 0x6,
|
||||||
|
ITEM_FLOATEXP_TGT_FORECOLOR_RGB = 0x7,
|
||||||
|
ITEM_FLOATEXP_TGT_FORECOLOR_A = 0x8,
|
||||||
|
ITEM_FLOATEXP_TGT_GLOWCOLOR_R = 0x9,
|
||||||
|
ITEM_FLOATEXP_TGT_GLOWCOLOR_G = 0xA,
|
||||||
|
ITEM_FLOATEXP_TGT_GLOWCOLOR_B = 0xB,
|
||||||
|
ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB = 0xC,
|
||||||
|
ITEM_FLOATEXP_TGT_GLOWCOLOR_A = 0xD,
|
||||||
|
ITEM_FLOATEXP_TGT_BACKCOLOR_R = 0xE,
|
||||||
|
ITEM_FLOATEXP_TGT_BACKCOLOR_G = 0xF,
|
||||||
|
ITEM_FLOATEXP_TGT_BACKCOLOR_B = 0x10,
|
||||||
|
ITEM_FLOATEXP_TGT_BACKCOLOR_RGB = 0x11,
|
||||||
|
ITEM_FLOATEXP_TGT_BACKCOLOR_A = 0x12,
|
||||||
|
|
||||||
|
ITEM_FLOATEXP_TGT_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ItemExpressionTargetBinding
|
||||||
|
{
|
||||||
|
int target;
|
||||||
|
const char* name;
|
||||||
|
const char* componentName;
|
||||||
|
};
|
||||||
|
|
||||||
struct ItemFloatExpression
|
struct ItemFloatExpression
|
||||||
{
|
{
|
||||||
int target;
|
int target;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||||
#include "Menu/MenuDumper.h"
|
#include "Menu/MenuDumper.h"
|
||||||
@ -203,6 +204,29 @@ namespace IW4
|
|||||||
"allsplitscreenprofilesaresignedin",
|
"allsplitscreenprofilesaresignedin",
|
||||||
"coopready",
|
"coopready",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT]
|
||||||
|
{
|
||||||
|
{ITEM_FLOATEXP_TGT_RECT_X, "rect", "x"},
|
||||||
|
{ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y"},
|
||||||
|
{ITEM_FLOATEXP_TGT_RECT_W, "rect", "w"},
|
||||||
|
{ITEM_FLOATEXP_TGT_RECT_H, "rect", "h"},
|
||||||
|
{ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r"},
|
||||||
|
{ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g"},
|
||||||
|
{ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b"},
|
||||||
|
{ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"},
|
||||||
|
{ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a"},
|
||||||
|
{ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r"},
|
||||||
|
{ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g"},
|
||||||
|
{ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b"},
|
||||||
|
{ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"},
|
||||||
|
{ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a"},
|
||||||
|
{ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r"},
|
||||||
|
{ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g"},
|
||||||
|
{ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b"},
|
||||||
|
{ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"},
|
||||||
|
{ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a"},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class MenuDumperIw4 : public MenuDumper
|
class MenuDumperIw4 : public MenuDumper
|
||||||
@ -344,6 +368,16 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
WriteStringProperty(propertyKey, soundAliasValue->aliasName);
|
WriteStringProperty(propertyKey, soundAliasValue->aliasName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteDecodeEffectProperty(const std::string& propertyKey, const itemDef_s* item) const
|
||||||
|
{
|
||||||
|
if (!item->decayActive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Indent();
|
||||||
|
WriteKey(propertyKey);
|
||||||
|
m_stream << item->fxLetterTime << " " << item->fxDecayStartTime << " " << item->fxDecayDuration << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
static size_t FindStatementClosingParenthesis(const Statement_s* statement, const size_t openingParenthesisPosition)
|
static size_t FindStatementClosingParenthesis(const Statement_s* statement, const size_t openingParenthesisPosition)
|
||||||
{
|
{
|
||||||
assert(statement->numEntries >= 0);
|
assert(statement->numEntries >= 0);
|
||||||
@ -394,9 +428,9 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
currentPos = closingParenPos + 1;
|
currentPos = closingParenPos + 1;
|
||||||
spaceNext = true;
|
spaceNext = true;
|
||||||
}
|
}
|
||||||
else if(expEntry.data.op >= EXP_FUNC_STATIC_DVAR_INT && expEntry.data.op <= EXP_FUNC_STATIC_DVAR_STRING)
|
else if (expEntry.data.op >= EXP_FUNC_STATIC_DVAR_INT && expEntry.data.op <= EXP_FUNC_STATIC_DVAR_STRING)
|
||||||
{
|
{
|
||||||
switch(expEntry.data.op)
|
switch (expEntry.data.op)
|
||||||
{
|
{
|
||||||
case EXP_FUNC_STATIC_DVAR_INT:
|
case EXP_FUNC_STATIC_DVAR_INT:
|
||||||
m_stream << "dvarint";
|
m_stream << "dvarint";
|
||||||
@ -422,18 +456,18 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
const auto closingParenPos = FindStatementClosingParenthesis(statement, currentPos);
|
const auto closingParenPos = FindStatementClosingParenthesis(statement, currentPos);
|
||||||
m_stream << "(";
|
m_stream << "(";
|
||||||
|
|
||||||
if(closingParenPos - currentPos + 1 >= 1)
|
if (closingParenPos - currentPos + 1 >= 1)
|
||||||
{
|
{
|
||||||
const auto& staticDvarEntry = statement->entries[currentPos + 1];
|
const auto& staticDvarEntry = statement->entries[currentPos + 1];
|
||||||
if(staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)
|
if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)
|
||||||
{
|
{
|
||||||
if(statement->supportingData
|
if (statement->supportingData
|
||||||
&& statement->supportingData->staticDvarList.staticDvars
|
&& statement->supportingData->staticDvarList.staticDvars
|
||||||
&& staticDvarEntry.data.operand.internals.intVal >= 0
|
&& staticDvarEntry.data.operand.internals.intVal >= 0
|
||||||
&& staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars)
|
&& staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars)
|
||||||
{
|
{
|
||||||
const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal];
|
const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal];
|
||||||
if(staticDvar && staticDvar->dvarName)
|
if (staticDvar && staticDvar->dvarName)
|
||||||
m_stream << staticDvar->dvarName;
|
m_stream << staticDvar->dvarName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -496,28 +530,28 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VAL_FUNCTION:
|
case VAL_FUNCTION:
|
||||||
{
|
|
||||||
int functionIndex = -1;
|
|
||||||
if (statement->supportingData && statement->supportingData->uifunctions.functions)
|
|
||||||
{
|
{
|
||||||
for (auto supportingFunctionIndex = 0; supportingFunctionIndex < statement->supportingData->uifunctions.totalFunctions; supportingFunctionIndex++)
|
int functionIndex = -1;
|
||||||
|
if (statement->supportingData && statement->supportingData->uifunctions.functions)
|
||||||
{
|
{
|
||||||
if (statement->supportingData->uifunctions.functions[supportingFunctionIndex] == operand.internals.function)
|
for (auto supportingFunctionIndex = 0; supportingFunctionIndex < statement->supportingData->uifunctions.totalFunctions; supportingFunctionIndex++)
|
||||||
{
|
{
|
||||||
functionIndex = supportingFunctionIndex;
|
if (statement->supportingData->uifunctions.functions[supportingFunctionIndex] == operand.internals.function)
|
||||||
break;
|
{
|
||||||
|
functionIndex = supportingFunctionIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (functionIndex >= 0)
|
||||||
|
m_stream << "FUNC_" << functionIndex;
|
||||||
|
else
|
||||||
|
m_stream << "INVALID_FUNC";
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionIndex >= 0)
|
|
||||||
m_stream << "FUNC_" << functionIndex;
|
|
||||||
else
|
|
||||||
m_stream << "INVALID_FUNC";
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -536,7 +570,7 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
while (currentPos < endOffset)
|
while (currentPos < endOffset)
|
||||||
{
|
{
|
||||||
const auto& expEntry = statement->entries[currentPos];
|
const auto& expEntry = statement->entries[currentPos];
|
||||||
|
|
||||||
if (expEntry.type == EET_OPERATOR)
|
if (expEntry.type == EET_OPERATOR)
|
||||||
{
|
{
|
||||||
WriteStatementOperator(statement, currentPos, spaceNext);
|
WriteStatementOperator(statement, currentPos, spaceNext);
|
||||||
@ -590,6 +624,25 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteFloatExpressionsProperty(const ItemFloatExpression* floatExpressions, const int floatExpressionCount) const
|
||||||
|
{
|
||||||
|
if (!floatExpressions)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < floatExpressionCount; i++)
|
||||||
|
{
|
||||||
|
const auto& floatExpression = floatExpressions[i];
|
||||||
|
|
||||||
|
if (floatExpression.target < 0 || floatExpression.target >= ITEM_FLOATEXP_TGT_COUNT)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string propertyName = std::string("exp ") + floatExpressionTargetBindings[floatExpression.target].name + std::string(" ")
|
||||||
|
+ floatExpressionTargetBindings[floatExpression.target].componentName;
|
||||||
|
|
||||||
|
WriteStatementProperty(propertyName, floatExpression.expression, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WriteItemData(const itemDef_s* item)
|
void WriteItemData(const itemDef_s* item)
|
||||||
{
|
{
|
||||||
WriteStringProperty("name", item->window.name);
|
WriteStringProperty("name", item->window.name);
|
||||||
@ -648,10 +701,10 @@ class MenuDumperIw4 : public MenuDumper
|
|||||||
WriteStatementProperty("exp text", item->textExp, false);
|
WriteStatementProperty("exp text", item->textExp, false);
|
||||||
WriteStatementProperty("exp material", item->materialExp, false);
|
WriteStatementProperty("exp material", item->materialExp, false);
|
||||||
WriteStatementProperty("exp disabled", item->disabledExp, false);
|
WriteStatementProperty("exp disabled", item->disabledExp, false);
|
||||||
// floatexpressions
|
WriteFloatExpressionsProperty(item->floatExpressions, item->floatExpressionCount);
|
||||||
WriteIntProperty("gamemsgwindowindex", item->gameMsgWindowIndex, 0);
|
WriteIntProperty("gamemsgwindowindex", item->gameMsgWindowIndex, 0);
|
||||||
WriteIntProperty("gamemsgwindowmode", item->gameMsgWindowMode, 0);
|
WriteIntProperty("gamemsgwindowmode", item->gameMsgWindowMode, 0);
|
||||||
// decodeEffect
|
WriteDecodeEffectProperty("decodeEffect", item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteItemDefs(const itemDef_s* const* itemDefs, const size_t itemCount)
|
void WriteItemDefs(const itemDef_s* const* itemDefs, const size_t itemCount)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user