|
14 | 14 | #include "PhysicsShellHolder.h" |
15 | 15 | #include "entity_alive.h" |
16 | 16 | #include "Level.h" |
| 17 | +#include "../xrUICore/ui_base.h" |
| 18 | +#include "../xrUICore/UIFontDefines.h" |
17 | 19 | #include "game_cl_base.h" |
18 | 20 | #include "Actor.h" |
19 | 21 | #include "Include/xrRender/Kinematics.h" |
@@ -66,6 +68,11 @@ CInventoryItem::CInventoryItem() |
66 | 68 | m_Description = ""; |
67 | 69 | m_section_id = 0; |
68 | 70 | m_flags.set(FIsHelperItem, FALSE); |
| 71 | + |
| 72 | + m_custom_text = nullptr; |
| 73 | + m_custom_text_font = nullptr; |
| 74 | + m_custom_text_clr_inv = 0; |
| 75 | + m_custom_text_offset.set(0.f, 0.f); |
69 | 76 | } |
70 | 77 |
|
71 | 78 | CInventoryItem::~CInventoryItem() |
@@ -129,6 +136,76 @@ void CInventoryItem::Load(LPCSTR section) |
129 | 136 | m_fControlInertionFactor = g_normalize_mouse_sens ? 1.0f : pSettings->read_if_exists<float>(section, "control_inertion_factor", 1.0f); |
130 | 137 | } |
131 | 138 | m_icon_name = READ_IF_EXISTS(pSettings, r_string, section, "icon_name", NULL); |
| 139 | + |
| 140 | + ReadCustomTextAndMarks(section); |
| 141 | +} |
| 142 | + |
| 143 | +void CInventoryItem::ReadCustomTextAndMarks(LPCSTR section) |
| 144 | +{ |
| 145 | + m_custom_text = READ_IF_EXISTS(pSettings, r_string, section, "item_custom_text", nullptr); |
| 146 | + m_custom_text_offset = |
| 147 | + READ_IF_EXISTS(pSettings, r_fvector2, section, "item_custom_text_offset", Fvector2().set(0.f, 0.f)); |
| 148 | + |
| 149 | + if (pSettings->line_exist(section, "item_custom_text_font")) |
| 150 | + { |
| 151 | + shared_str font_str = pSettings->r_string(section, "item_custom_text_font"); |
| 152 | + if (!xr_strcmp(font_str, GRAFFITI19_FONT_NAME)) |
| 153 | + { |
| 154 | + m_custom_text_font = UI().Font().pFontGraffiti19Russian; |
| 155 | + } |
| 156 | + else if (!xr_strcmp(font_str, GRAFFITI22_FONT_NAME)) |
| 157 | + { |
| 158 | + m_custom_text_font = UI().Font().pFontGraffiti22Russian; |
| 159 | + } |
| 160 | + else if (!xr_strcmp(font_str, GRAFFITI32_FONT_NAME)) |
| 161 | + { |
| 162 | + m_custom_text_font = UI().Font().pFontGraffiti32Russian; |
| 163 | + } |
| 164 | + else if (!xr_strcmp(font_str, GRAFFITI50_FONT_NAME)) |
| 165 | + { |
| 166 | + m_custom_text_font = UI().Font().pFontGraffiti50Russian; |
| 167 | + } |
| 168 | + else if (!xr_strcmp(font_str, ARIAL14_FONT_NAME)) |
| 169 | + { |
| 170 | + m_custom_text_font = UI().Font().pFontArial14; |
| 171 | + } |
| 172 | + else if (!xr_strcmp(font_str, MEDIUM_FONT_NAME)) |
| 173 | + { |
| 174 | + m_custom_text_font = UI().Font().pFontMedium; |
| 175 | + } |
| 176 | + else if (!xr_strcmp(font_str, SMALL_FONT_NAME)) |
| 177 | + { |
| 178 | + m_custom_text_font = UI().Font().pFontStat; |
| 179 | + } |
| 180 | + else if (!xr_strcmp(font_str, LETTERICA16_FONT_NAME)) |
| 181 | + { |
| 182 | + m_custom_text_font = UI().Font().pFontLetterica16Russian; |
| 183 | + } |
| 184 | + else if (!xr_strcmp(font_str, LETTERICA18_FONT_NAME)) |
| 185 | + { |
| 186 | + m_custom_text_font = UI().Font().pFontLetterica18Russian; |
| 187 | + } |
| 188 | + else if (!xr_strcmp(font_str, LETTERICA25_FONT_NAME)) |
| 189 | + { |
| 190 | + m_custom_text_font = UI().Font().pFontLetterica25; |
| 191 | + } |
| 192 | + else if (!xr_strcmp(font_str, DI_FONT_NAME)) |
| 193 | + { |
| 194 | + m_custom_text_font = UI().Font().pFontDI; |
| 195 | + } |
| 196 | + else |
| 197 | + { |
| 198 | + m_custom_text_font = nullptr; |
| 199 | + } |
| 200 | + } |
| 201 | + if (pSettings->line_exist(section, "item_custom_text_clr_inv")) |
| 202 | + { |
| 203 | + m_custom_text_clr_inv = pSettings->r_color(section, "item_custom_text_clr_inv"); |
| 204 | + } |
| 205 | + else |
| 206 | + { |
| 207 | + m_custom_text_clr_inv = 0; |
| 208 | + } |
132 | 209 | } |
133 | 210 |
|
134 | 211 | void CInventoryItem::ReloadNames() |
|
0 commit comments