selectionbox_argb = video::SColor(255, sbox_r, sbox_g, sbox_b);
use_crosshair_image = tsrc->isKnownSourceImage("crosshair.png");
- use_hotbar_bg_img = tsrc->isKnownSourceImage("hotbar.png");
- use_hotbar_border_img = tsrc->isKnownSourceImage("hotbar_selected.png");
+
+ hotbar_image = "";
+ use_hotbar_image = false;
+ hotbar_selected_image = "";
+ use_hotbar_selected_image = false;
}
const video::SColor hbar_color(255, 255, 255, 255);
const video::SColor hbar_colors[] = {hbar_color, hbar_color, hbar_color, hbar_color};
- if (use_hotbar_bg_img) {
+ if (hotbar_image != player->hotbar_image) {
+ hotbar_image = player->hotbar_image;
+ if (hotbar_image != "")
+ use_hotbar_image = tsrc->isKnownSourceImage(hotbar_image);
+ else
+ use_hotbar_image = false;
+ }
+
+ if (hotbar_selected_image != player->hotbar_selected_image) {
+ hotbar_selected_image = player->hotbar_selected_image;
+ if (hotbar_selected_image != "")
+ use_hotbar_selected_image = tsrc->isKnownSourceImage(hotbar_selected_image);
+ else
+ use_hotbar_selected_image = false;
+ }
+
+ if (use_hotbar_image) {
core::rect<s32> imgrect2(-padding/2, -padding/2, width+padding/2, height+padding/2);
core::rect<s32> rect2 = imgrect2 + pos;
- video::ITexture *texture = tsrc->getTexture("hotbar.png");
+ video::ITexture *texture = tsrc->getTexture(hotbar_image);
core::dimension2di imgsize(texture->getOriginalSize());
driver->draw2DImage(texture, rect2,
core::rect<s32>(core::position2d<s32>(0,0), imgsize),
core::rect<s32> rect = imgrect + pos + steppos;
if (selectitem == i + 1) {
- if (use_hotbar_border_img) {
+ if (use_hotbar_selected_image) {
core::rect<s32> imgrect2(-padding*2, -padding*2, height, height);
rect = imgrect2 + pos + steppos;
- video::ITexture *texture = tsrc->getTexture("hotbar_selected.png");
+ video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
core::dimension2di imgsize(texture->getOriginalSize());
driver->draw2DImage(texture, rect,
core::rect<s32>(core::position2d<s32>(0,0), imgsize),
}
video::SColor bgcolor2(128, 0, 0, 0);
- if (!use_hotbar_bg_img)
+ if (!use_hotbar_image)
driver->draw2DRectangle(bgcolor2, rect, NULL);
drawItemStack(driver, font, item, rect, NULL, gamedef);
}
const video::SColor color(255, 255, 255, 255);
const video::SColor colors[] = {color, color, color, color};
core::dimension2di imgsize(texture->getOriginalSize());
- core::rect<s32> rect(0, 0, imgsize.Width * e->scale.X,
- imgsize.Height * e->scale.X);
- rect += pos;
- v2s32 offset((e->align.X - 1.0) * ((imgsize.Width * e->scale.X) / 2),
- (e->align.Y - 1.0) * ((imgsize.Height * e->scale.X) / 2));
- rect += offset;
- rect += v2s32(e->offset.X, e->offset.Y);
+ v2s32 dstsize(imgsize.Width * e->scale.X,
+ imgsize.Height * e->scale.Y);
+ if (e->scale.X < 0)
+ dstsize.X = screensize.X * (e->scale.X * -0.01);
+ if (e->scale.Y < 0)
+ dstsize.Y = screensize.Y * (e->scale.Y * -0.01);
+ v2s32 offset((e->align.X - 1.0) * dstsize.X / 2,
+ (e->align.Y - 1.0) * dstsize.Y / 2);
+ core::rect<s32> rect(0, 0, dstsize.X, dstsize.Y);
+ rect += pos + offset + v2s32(e->offset.X, e->offset.Y);
driver->draw2DImage(texture, rect,
core::rect<s32>(core::position2d<s32>(0,0), imgsize),
NULL, colors, true);
s32 hotbar_itemcount = player->hud_hotbar_itemcount;
s32 padding = hotbar_imagesize / 12;
s32 width = hotbar_itemcount * (hotbar_imagesize + padding * 2);
- v2s32 pos = centerlowerpos - v2s32(width / 2, hotbar_imagesize + padding * 2);
+ v2s32 pos = centerlowerpos - v2s32(width / 2, hotbar_imagesize + padding * 3);
if (player->hud_flags & HUD_FLAG_HOTBAR_VISIBLE)
drawItem(pos, hotbar_imagesize, hotbar_itemcount, mainlist, playeritem + 1, 0);