55
66#include " Include/xrRender/UIShader.h"
77
8- CUIStatsIcon::TEX_INFO CUIStatsIcon::m_tex_info[MAX_DEF_TEX ][2 ];
9-
108CUIStatsIcon::CUIStatsIcon ()
119 : CUIStatic(" CUIStatsIcon" )
1210{
@@ -16,19 +14,22 @@ CUIStatsIcon::CUIStatsIcon()
1614
1715void CUIStatsIcon::InitTexInfo ()
1816{
19- if (m_tex_info[ RANK_0 ][ 0 ]. sh -> inited () )
17+ if (m_tex_info)
2018 return ;
19+
20+ m_tex_info = xr_new<tex_info_data>();
21+
2122 // ranks
2223 string128 rank_tex;
2324 for (int i = RANK_0 ; i <= RANK_4 ; i++)
2425 {
2526 xr_sprintf (rank_tex, " ui_hud_status_green_0%d" , i + 1 );
26- CUITextureMaster::GetTextureShader (rank_tex, m_tex_info[i][0 ].sh );
27- m_tex_info[i][0 ].rect = CUITextureMaster::GetTextureRect (rank_tex);
27+ CUITextureMaster::GetTextureShader (rank_tex, (* m_tex_info) [i][0 ].sh );
28+ (* m_tex_info) [i][0 ].rect = CUITextureMaster::GetTextureRect (rank_tex);
2829
2930 xr_sprintf (rank_tex, " ui_hud_status_blue_0%d" , i + 1 );
30- CUITextureMaster::GetTextureShader (rank_tex, m_tex_info[i][1 ].sh );
31- m_tex_info[i][1 ].rect = CUITextureMaster::GetTextureRect (rank_tex);
31+ CUITextureMaster::GetTextureShader (rank_tex, (* m_tex_info) [i][1 ].sh );
32+ (* m_tex_info) [i][1 ].rect = CUITextureMaster::GetTextureRect (rank_tex);
3233 }
3334
3435 // artefact
@@ -38,33 +39,35 @@ void CUIStatsIcon::InitTexInfo()
3839 float fXPos = pSettings->r_float (artefact_name, " inv_grid_x" );
3940 float fYPos = pSettings->r_float (artefact_name, " inv_grid_y" );
4041
41- m_tex_info[ARTEFACT ][0 ].sh = InventoryUtilities::GetEquipmentIconsShader ();
42- m_tex_info[ARTEFACT ][0 ].rect .set (fXPos * INV_GRID_WIDTH , fYPos * INV_GRID_HEIGHT ,
42+ (* m_tex_info) [ARTEFACT ][0 ].sh = InventoryUtilities::GetEquipmentIconsShader ();
43+ (* m_tex_info) [ARTEFACT ][0 ].rect .set (fXPos * INV_GRID_WIDTH , fYPos * INV_GRID_HEIGHT ,
4344 fXPos * INV_GRID_WIDTH + fGridWidth * INV_GRID_WIDTH , fYPos * INV_GRID_HEIGHT + fGridHeight * INV_GRID_HEIGHT );
4445
45- m_tex_info[ARTEFACT ][1 ] = m_tex_info[ARTEFACT ][0 ];
46+ (* m_tex_info) [ARTEFACT ][1 ] = (* m_tex_info) [ARTEFACT ][0 ];
4647
4748 // death
48- m_tex_info[DEATH ][0 ].sh ->create (" hud" DELIMITER " default" , " ui" DELIMITER " ui_mp_icon_kill" );
49- m_tex_info[DEATH ][1 ] = m_tex_info[DEATH ][0 ];
50- m_tex_info[DEATH ][0 ].rect .x1 = 32 ;
51- m_tex_info[DEATH ][0 ].rect .y1 = 202 ;
52- m_tex_info[DEATH ][0 ].rect .x2 = m_tex_info[DEATH ][0 ].rect .x1 + 30 ;
53- m_tex_info[DEATH ][0 ].rect .y2 = m_tex_info[DEATH ][0 ].rect .y1 + 30 ;
49+ (* m_tex_info) [DEATH ][0 ].sh ->create (" hud" DELIMITER " default" , " ui" DELIMITER " ui_mp_icon_kill" );
50+ (* m_tex_info) [DEATH ][1 ] = (* m_tex_info) [DEATH ][0 ];
51+ (* m_tex_info) [DEATH ][0 ].rect .x1 = 32 ;
52+ (* m_tex_info) [DEATH ][0 ].rect .y1 = 202 ;
53+ (* m_tex_info) [DEATH ][0 ].rect .x2 = (* m_tex_info) [DEATH ][0 ].rect .x1 + 30 ;
54+ (* m_tex_info) [DEATH ][0 ].rect .y2 = (* m_tex_info) [DEATH ][0 ].rect .y1 + 30 ;
5455}
5556
5657void CUIStatsIcon::FreeTexInfo ()
5758{
5859 // ranks
5960 for (int i = RANK_0 ; i <= RANK_4 ; i++)
6061 {
61- m_tex_info[i][0 ].sh ->destroy ();
62- m_tex_info[i][1 ].sh ->destroy ();
62+ (* m_tex_info) [i][0 ].sh ->destroy ();
63+ (* m_tex_info) [i][1 ].sh ->destroy ();
6364 }
64- m_tex_info[ARTEFACT ][0 ].sh ->destroy ();
65- m_tex_info[ARTEFACT ][1 ].sh ->destroy ();
66- m_tex_info[DEATH ][0 ].sh ->destroy ();
67- m_tex_info[DEATH ][1 ].sh ->destroy ();
65+ (*m_tex_info)[ARTEFACT ][0 ].sh ->destroy ();
66+ (*m_tex_info)[ARTEFACT ][1 ].sh ->destroy ();
67+ (*m_tex_info)[DEATH ][0 ].sh ->destroy ();
68+ (*m_tex_info)[DEATH ][1 ].sh ->destroy ();
69+
70+ xr_delete (m_tex_info);
6871}
6972
7073void CUIStatsIcon::SetValue (LPCSTR str)
@@ -85,18 +88,18 @@ void CUIStatsIcon::SetValue(LPCSTR str)
8588
8689 const int rank = atoi (strchr (str, ' 0' )) - 1 ;
8790
88- SetShader (m_tex_info[rank][team].sh );
89- SetTextureRect (m_tex_info[rank][team].rect );
91+ SetShader ((* m_tex_info) [rank][team].sh );
92+ SetTextureRect ((* m_tex_info) [rank][team].rect );
9093 }
9194 else if (0 == xr_strcmp (str, " death" ))
9295 {
93- SetShader (m_tex_info[DEATH ][0 ].sh );
94- SetTextureRect (m_tex_info[DEATH ][0 ].rect );
96+ SetShader ((* m_tex_info) [DEATH ][0 ].sh );
97+ SetTextureRect ((* m_tex_info) [DEATH ][0 ].rect );
9598 }
9699 else if (0 == xr_strcmp (str, " artefact" ))
97100 {
98- SetShader (m_tex_info[ARTEFACT ][0 ].sh );
99- SetTextureRect (m_tex_info[ARTEFACT ][0 ].rect );
101+ SetShader ((* m_tex_info) [ARTEFACT ][0 ].sh );
102+ SetTextureRect ((* m_tex_info) [ARTEFACT ][0 ].rect );
100103 }
101104 else
102105 {
0 commit comments