Dump menu float expressions

This commit is contained in:
Jan 2021-10-16 17:22:38 +02:00
parent 0f7a8ca1c9
commit 96774b96ba
2 changed files with 110 additions and 25 deletions

View File

@ -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;

View File

@ -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);
@ -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)