mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-09-23 06:17:07 +00:00
fix: preserve special menu item text flags (#1011)
* fix: preserve T4 special menu item text flags * fix: preserve IW3 special menu item text flags * refactor: define IW3 and T4 dynamic window flags * chore: also apply WindowDefDynamicFlag changes to iw4 and iw5 --------- Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
@@ -2528,18 +2528,18 @@ namespace IW3
|
||||
|
||||
enum WindowDefDynamicFlag : unsigned int
|
||||
{
|
||||
WINDOW_FLAG_1 = 0x1,
|
||||
WINDOW_FLAG_MOUSE_OVER = 0x1,
|
||||
WINDOW_FLAG_FOCUSED = 0x2,
|
||||
WINDOW_FLAG_VISIBLE = 0x4,
|
||||
WINDOW_FLAG_FADING_OUT = 0x10,
|
||||
WINDOW_FLAG_FADING_IN = 0x20,
|
||||
WINDOW_FLAG_HOVERED = 0x40,
|
||||
WINDOW_FLAG_LISTBOX_HOVER_100 = 0x100,
|
||||
WINDOW_FLAG_LISTBOX_HOVER_200 = 0x200,
|
||||
WINDOW_FLAG_LISTBOX_HOVER_400 = 0x400,
|
||||
WINDOW_FLAG_LISTBOX_HOVER_800 = 0x800,
|
||||
WINDOW_FLAG_LISTBOX_HOVER_1000 = 0x1000,
|
||||
WINDOW_FLAG_4000 = 0x4000,
|
||||
WINDOW_FLAG_MOUSE_OVER_TEXT = 0x40,
|
||||
WINDOW_FLAG_LISTBOX_PREV_ARROW = 0x100,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_ARROW = 0x200,
|
||||
WINDOW_FLAG_LISTBOX_THUMB = 0x400,
|
||||
WINDOW_FLAG_LISTBOX_PREV_PAGE = 0x800,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_PAGE = 0x1000,
|
||||
WINDOW_FLAG_FORCED_VISIBLE = 0x4000,
|
||||
WINDOW_FLAG_NON_DEFAULT_BACKCOLOR = 0x8000,
|
||||
WINDOW_FLAG_NON_DEFAULT_FORECOLOR = 0x10000,
|
||||
};
|
||||
@@ -2787,6 +2787,12 @@ namespace IW3
|
||||
ITEM_TYPE_GAME_MESSAGE_WINDOW = 0x13
|
||||
};
|
||||
|
||||
enum ItemDefFlag : unsigned int
|
||||
{
|
||||
ITEM_FLAG_SAVE_GAME_INFO = 0x1,
|
||||
ITEM_FLAG_CINEMATIC_SUBTITLE = 0x2,
|
||||
};
|
||||
|
||||
enum ItemDefDvarFlag
|
||||
{
|
||||
ITEM_DVAR_FLAG_ENABLE = 0x1,
|
||||
|
||||
@@ -2294,12 +2294,18 @@ namespace IW4
|
||||
|
||||
enum WindowDefDynamicFlag : unsigned int
|
||||
{
|
||||
WINDOW_FLAG_HOVERED = 0x1, // guessed
|
||||
WINDOW_FLAG_MOUSE_OVER = 0x1,
|
||||
WINDOW_FLAG_FOCUSED = 0x2,
|
||||
WINDOW_FLAG_VISIBLE = 0x4,
|
||||
WINDOW_FLAG_FADING_OUT = 0x10,
|
||||
WINDOW_FLAG_FADING_IN = 0x20,
|
||||
WINDOW_FLAG_MOUSE_OVER_TEXT = 0x40,
|
||||
WINDOW_FLAG_80 = 0x80,
|
||||
WINDOW_FLAG_LISTBOX_PREV_ARROW = 0x100,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_ARROW = 0x200,
|
||||
WINDOW_FLAG_LISTBOX_THUMB = 0x400,
|
||||
WINDOW_FLAG_LISTBOX_PREV_PAGE = 0x800,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_PAGE = 0x1000,
|
||||
WINDOW_FLAG_NON_DEFAULT_BACKCOLOR = 0x8000,
|
||||
WINDOW_FLAG_NON_DEFAULT_FORECOLOR = 0x10000
|
||||
};
|
||||
|
||||
@@ -3214,12 +3214,18 @@ namespace IW5
|
||||
// This is data from IW4, could be different for IW5, to be investigated
|
||||
enum WindowDefDynamicFlag : unsigned int
|
||||
{
|
||||
WINDOW_FLAG_HOVERED = 0x1, // guessed
|
||||
WINDOW_FLAG_MOUSE_OVER = 0x1,
|
||||
WINDOW_FLAG_FOCUSED = 0x2,
|
||||
WINDOW_FLAG_VISIBLE = 0x4, // confirmed
|
||||
WINDOW_FLAG_FADING_OUT = 0x10,
|
||||
WINDOW_FLAG_FADING_IN = 0x20,
|
||||
WINDOW_FLAG_MOUSE_OVER_TEXT = 0x40,
|
||||
WINDOW_FLAG_80 = 0x80,
|
||||
WINDOW_FLAG_LISTBOX_PREV_ARROW = 0x100,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_ARROW = 0x200,
|
||||
WINDOW_FLAG_LISTBOX_THUMB = 0x400,
|
||||
WINDOW_FLAG_LISTBOX_PREV_PAGE = 0x800,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_PAGE = 0x1000,
|
||||
WINDOW_FLAG_NON_DEFAULT_BACKCOLOR = 0x8000,
|
||||
WINDOW_FLAG_NON_DEFAULT_FORECOLOR = 0x10000
|
||||
};
|
||||
|
||||
@@ -2790,7 +2790,18 @@ namespace T4
|
||||
|
||||
enum WindowDefDynamicFlag : unsigned int
|
||||
{
|
||||
WINDOW_FLAG_MOUSE_OVER = 0x1,
|
||||
WINDOW_FLAG_FOCUSED = 0x2,
|
||||
WINDOW_FLAG_VISIBLE = 0x4,
|
||||
WINDOW_FLAG_FADING_OUT = 0x10,
|
||||
WINDOW_FLAG_FADING_IN = 0x20,
|
||||
WINDOW_FLAG_MOUSE_OVER_TEXT = 0x40,
|
||||
WINDOW_FLAG_LISTBOX_PREV_ARROW = 0x100,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_ARROW = 0x200,
|
||||
WINDOW_FLAG_LISTBOX_THUMB = 0x400,
|
||||
WINDOW_FLAG_LISTBOX_PREV_PAGE = 0x800,
|
||||
WINDOW_FLAG_LISTBOX_NEXT_PAGE = 0x1000,
|
||||
WINDOW_FLAG_FORCED_VISIBLE = 0x4000,
|
||||
WINDOW_FLAG_NON_DEFAULT_BACKCOLOR = 0x8000,
|
||||
WINDOW_FLAG_NON_DEFAULT_FORECOLOR = 0x10000,
|
||||
};
|
||||
@@ -3057,6 +3068,12 @@ namespace T4
|
||||
ITEM_TYPE_GAME_MESSAGE_WINDOW = 0x13
|
||||
};
|
||||
|
||||
enum ItemDefFlag : unsigned int
|
||||
{
|
||||
ITEM_FLAG_SAVE_GAME_INFO = 0x1,
|
||||
ITEM_FLAG_CINEMATIC_SUBTITLE = 0x2,
|
||||
};
|
||||
|
||||
enum ItemDefDvarFlag
|
||||
{
|
||||
ITEM_DVAR_FLAG_ENABLE = 0x1,
|
||||
|
||||
@@ -562,6 +562,16 @@ namespace
|
||||
|
||||
item->window.name = ConvertString(commonItem.m_name);
|
||||
item->text = commonItem.m_text ? m_memory.Dup(commonItem.m_text->c_str()) : nullptr;
|
||||
if (commonItem.m_text_save_game)
|
||||
{
|
||||
item->text = m_memory.Dup("savegameinfo");
|
||||
item->itemFlags |= ITEM_FLAG_SAVE_GAME_INFO;
|
||||
}
|
||||
if (commonItem.m_text_cinematic_subtitle)
|
||||
{
|
||||
item->text = m_memory.Dup("cinematicsubtitle");
|
||||
item->itemFlags |= ITEM_FLAG_CINEMATIC_SUBTITLE;
|
||||
}
|
||||
item->window.group = ConvertString(commonItem.m_group);
|
||||
item->window.rectClient = ConvertRectDef(commonItem.m_rect);
|
||||
item->window.style = commonItem.m_style;
|
||||
|
||||
@@ -566,6 +566,16 @@ namespace
|
||||
|
||||
item->window.name = ConvertString(commonItem.m_name);
|
||||
item->text = commonItem.m_text ? m_memory.Dup(commonItem.m_text->c_str()) : nullptr;
|
||||
if (commonItem.m_text_save_game)
|
||||
{
|
||||
item->text = m_memory.Dup("savegameinfo");
|
||||
item->itemFlags |= ITEM_FLAG_SAVE_GAME_INFO;
|
||||
}
|
||||
if (commonItem.m_text_cinematic_subtitle)
|
||||
{
|
||||
item->text = m_memory.Dup("cinematicsubtitle");
|
||||
item->itemFlags |= ITEM_FLAG_CINEMATIC_SUBTITLE;
|
||||
}
|
||||
item->window.group = ConvertString(commonItem.m_group);
|
||||
item->window.rectClient = ConvertRectDef(commonItem.m_rect);
|
||||
item->window.style = commonItem.m_style;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
@@ -535,10 +536,29 @@ namespace
|
||||
m_stream << "\n";
|
||||
}
|
||||
|
||||
void WriteItemTextProperties(const itemDef_s& item) const
|
||||
{
|
||||
const char* implicitText = nullptr;
|
||||
|
||||
if (item.itemFlags & ITEM_FLAG_SAVE_GAME_INFO)
|
||||
{
|
||||
WriteKeywordProperty("textsavegame", true);
|
||||
implicitText = "savegameinfo";
|
||||
}
|
||||
if (item.itemFlags & ITEM_FLAG_CINEMATIC_SUBTITLE)
|
||||
{
|
||||
WriteKeywordProperty("textcinematicsubtitle", true);
|
||||
implicitText = "cinematicsubtitle";
|
||||
}
|
||||
|
||||
if (!implicitText || (item.text && std::strcmp(item.text, implicitText) != 0))
|
||||
WriteItemTextProperty(item.text);
|
||||
}
|
||||
|
||||
void WriteItemData(const itemDef_s& item)
|
||||
{
|
||||
WriteStringProperty("name", item.window.name);
|
||||
WriteItemTextProperty(item.text);
|
||||
WriteItemTextProperties(item);
|
||||
WriteStringProperty("group", item.window.group);
|
||||
WriteRectProperty("rect", item.window.rectClient);
|
||||
WriteIntProperty("style", item.window.style, 0);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
@@ -539,10 +540,29 @@ namespace
|
||||
m_stream << "\n";
|
||||
}
|
||||
|
||||
void WriteItemTextProperties(const itemDef_s& item) const
|
||||
{
|
||||
const char* implicitText = nullptr;
|
||||
|
||||
if (item.itemFlags & ITEM_FLAG_SAVE_GAME_INFO)
|
||||
{
|
||||
WriteKeywordProperty("textsavegame", true);
|
||||
implicitText = "savegameinfo";
|
||||
}
|
||||
if (item.itemFlags & ITEM_FLAG_CINEMATIC_SUBTITLE)
|
||||
{
|
||||
WriteKeywordProperty("textcinematicsubtitle", true);
|
||||
implicitText = "cinematicsubtitle";
|
||||
}
|
||||
|
||||
if (!implicitText || (item.text && std::strcmp(item.text, implicitText) != 0))
|
||||
WriteItemTextProperty(item.text);
|
||||
}
|
||||
|
||||
void WriteItemData(const itemDef_s& item)
|
||||
{
|
||||
WriteStringProperty("name", item.window.name);
|
||||
WriteItemTextProperty(item.text);
|
||||
WriteItemTextProperties(item);
|
||||
WriteStringProperty("group", item.window.group);
|
||||
WriteRectProperty("rect", item.window.rectClient);
|
||||
WriteIntProperty("style", item.window.style, 0);
|
||||
|
||||
Reference in New Issue
Block a user