right click add gem works

This commit is contained in:
Hash Borgir
2024-04-27 10:18:57 -06:00
parent f915859023
commit faf21e0a9d
48 changed files with 863 additions and 247 deletions

View File

@@ -222,7 +222,7 @@ static void draw_damage_labels() {
// Determine the color based on healthPercentage
diablo2::ui_color_t textColor;
textColor = healthPercentage >= 0.67f ? diablo2::UI_COLOR_GREEN : (healthPercentage <= 0.33f ? diablo2::UI_COLOR_RED : diablo2::UI_COLOR_YELLOW);
textColor = healthPercentage >= 0.8f ? diablo2::UI_COLOR_GREEN : (healthPercentage <= 0.5f ? diablo2::UI_COLOR_RED : diablo2::UI_COLOR_YELLOW);
// Construct the health fraction string
std::wstring fractionStr = std::to_wstring(label->currentHp) + L"/" + std::to_wstring(label->maxHp);
@@ -236,19 +236,22 @@ static void draw_damage_labels() {
uint32_t textY = my;
// Define default bar color
diablo2::ui_color_t barColor;
int barColor;
// Determine bar color based on health percentage
if (healthPercentage > .80) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GREEN;
barColor = 132;
}
else if (healthPercentage > .50) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GOLD;
barColor = 12;
}
else {
barColor = diablo2::ui_color_t::UI_COLOR_RED;
barColor = 10;
}
// Get the width of the combinedText string
int32_t combinedTextWidth = diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(combinedTextPtr));
// Draw the combined text (health percentage and bar text)
//diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedTcombinedTextext.c_str()), textX, textY, textColor, 0);
//diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(fractionStr.c_str()), textX + label->unit_width/2, textY - 12, 0, 0, textColor);
@@ -263,8 +266,8 @@ static void draw_damage_labels() {
int _barHeight = GetPrivateProfileIntA("Options", "barHeight", 0, "./D2Tweaks.ini");
diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); // Set font to FONT16
diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, barColor, 0);
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * 60, textY + _barHeight, 5, 255);
diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, textColor, 0);
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * combinedTextWidth, textY + _barHeight, barColor, 255);
const auto offset = static_cast<int32_t>(lerp(static_cast<float>(label->unit_height) + 5.f, static_cast<float>(label->unit_height) + 30.f, static_cast<float>(delta) / static_cast<float>(DISPLAY_TIME)));
my -= offset;