@@ -64,8 +64,11 @@ Hud::Hud(video::IVideoDriver *driver, gui::IGUIEnvironment* guienv,
64
64
selectionbox_argb = video::SColor (255 , sbox_r, sbox_g, sbox_b);
65
65
66
66
use_crosshair_image = tsrc->isKnownSourceImage (" crosshair.png" );
67
- use_hotbar_bg_img = tsrc->isKnownSourceImage (" hotbar.png" );
68
- use_hotbar_border_img = tsrc->isKnownSourceImage (" hotbar_selected.png" );
67
+
68
+ hotbar_image = " " ;
69
+ use_hotbar_image = false ;
70
+ hotbar_selected_image = " " ;
71
+ use_hotbar_selected_image = false ;
69
72
}
70
73
71
74
@@ -95,10 +98,26 @@ void Hud::drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount,
95
98
const video::SColor hbar_color (255 , 255 , 255 , 255 );
96
99
const video::SColor hbar_colors[] = {hbar_color, hbar_color, hbar_color, hbar_color};
97
100
98
- if (use_hotbar_bg_img) {
101
+ if (hotbar_image != player->hotbar_image ) {
102
+ hotbar_image = player->hotbar_image ;
103
+ if (hotbar_image != " " )
104
+ use_hotbar_image = tsrc->isKnownSourceImage (hotbar_image);
105
+ else
106
+ use_hotbar_image = false ;
107
+ }
108
+
109
+ if (hotbar_selected_image != player->hotbar_selected_image ) {
110
+ hotbar_selected_image = player->hotbar_selected_image ;
111
+ if (hotbar_selected_image != " " )
112
+ use_hotbar_selected_image = tsrc->isKnownSourceImage (hotbar_selected_image);
113
+ else
114
+ use_hotbar_selected_image = false ;
115
+ }
116
+
117
+ if (use_hotbar_image) {
99
118
core::rect<s32> imgrect2 (-padding/2 , -padding/2 , width+padding/2 , height+padding/2 );
100
119
core::rect<s32> rect2 = imgrect2 + pos;
101
- video::ITexture *texture = tsrc->getTexture (" hotbar.png " );
120
+ video::ITexture *texture = tsrc->getTexture (hotbar_image );
102
121
core::dimension2di imgsize (texture->getOriginalSize ());
103
122
driver->draw2DImage (texture, rect2,
104
123
core::rect<s32>(core::position2d<s32>(0 ,0 ), imgsize),
@@ -127,10 +146,10 @@ void Hud::drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount,
127
146
core::rect<s32> rect = imgrect + pos + steppos;
128
147
129
148
if (selectitem == i + 1 ) {
130
- if (use_hotbar_border_img ) {
149
+ if (use_hotbar_selected_image ) {
131
150
core::rect<s32> imgrect2 (-padding*2 , -padding*2 , height, height);
132
151
rect = imgrect2 + pos + steppos;
133
- video::ITexture *texture = tsrc->getTexture (" hotbar_selected.png " );
152
+ video::ITexture *texture = tsrc->getTexture (hotbar_selected_image );
134
153
core::dimension2di imgsize (texture->getOriginalSize ());
135
154
driver->draw2DImage (texture, rect,
136
155
core::rect<s32>(core::position2d<s32>(0 ,0 ), imgsize),
@@ -192,7 +211,7 @@ void Hud::drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount,
192
211
}
193
212
194
213
video::SColor bgcolor2 (128 , 0 , 0 , 0 );
195
- if (!use_hotbar_bg_img )
214
+ if (!use_hotbar_image )
196
215
driver->draw2DRectangle (bgcolor2, rect, NULL );
197
216
drawItemStack (driver, font, item, rect, NULL , gamedef);
198
217
}
0 commit comments