Globes removed, need to center bars

This commit is contained in:
Hash Borgir 2024-04-24 16:12:55 -06:00
parent 094a39a872
commit f32b70b4bb
42 changed files with 110 additions and 21 deletions

Binary file not shown.

View File

@ -1,3 +1,36 @@
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
client.cpp
autosort_client.cpp
auto_gold_pickup_client.cpp
auto_item_pickup_client.cpp
client_module.cpp
damage_display_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(138,12): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(144,31): warning C4244: '=': conversion from 'ULONGLONG' to 'long', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(252,59): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
item_drop_message_client.cpp
item_move_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\item_move\item_move_client.cpp(99,33): warning C4018: '<': signed/unsigned mismatch
loot_filter_settings_menu.cpp
loot_filter_settings_toggle_menu.cpp
small_patches.cpp
test.cpp
trader_update_client.cpp
transmute_client.cpp
asset_manager.cpp
trader_update_server.cpp
server.cpp
button.cpp
checkbox.cpp
group.cpp
image.cpp
label.cpp
menu.cpp
ui_manager.cpp
d2gfx.cpp
d2win.cpp
main.cpp
D2Template.cpp
DllNotify.cpp
LINK : ..\..\Diablo II\MODS\ironman-dev\D2tweaks.dll not found or not built by the last incremental link; performing full link
D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,7 +17,7 @@ namespace diablo2 {
static int32_t adjust_perspective_coords(int32_t x, int32_t y, int32_t* adjustX, int32_t* adjustY);
static int32_t get_resolution_mode();
static void draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, int32_t drawType, void* palette);
static void draw_filled_rect(int left, int top, int right, int bottom, ULONG color, ULONG transTbl);
static void draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl);
};
}

View File

@ -49,6 +49,7 @@ namespace diablo2 {
static void draw_text(wchar_t* str, uint32_t x, uint32_t y, ui_color_t color, int32_t transTbl);
static void draw_boxed_text(wchar_t* str, uint32_t x, uint32_t y, int32_t paletteIndex, int32_t transTbl, ui_color_t color);
static int32_t D2Win_10034_MixRGB(uint8_t nRed, uint8_t nGreen, uint8_t nBlue);
static void set_popup_properties(wchar_t* str, uint32_t x, uint32_t y, ui_color_t color, int32_t align);
static void draw_popup();

View File

@ -138,6 +138,7 @@ public:
int statsFont = GetPrivateProfileIntA("Options", "statsFont", 0, "./d2tweaks.ini");
void draw() override {
auto stats = globalStatsVector;
int textOffset = 40; // Initial offset for the first line
@ -319,12 +320,22 @@ public:
// print player health, mana, and stamina bars, lastexp, nextexp, and level
// Get current HP, Mana, and Stamina along with their maximum values
int statHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(6), NULL);
int statMaxHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(7), NULL);
int statMana = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(8), NULL);
int statMaxMana = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(9), NULL);
int statStamina = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(10), NULL);
int statMaxStamina = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(11), NULL);
int statHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(6), NULL) / 256;
int statMaxHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(7), NULL) / 256;
int statMana = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(8), NULL) / 256;
int statMaxMana = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(9), NULL) / 256;
int statStamina = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(10), NULL) / 256;
int statMaxStamina = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(11), NULL) / 256;
// Convert the integer values to wide character strings
std::wstring strHP = std::to_wstring(statHP);
std::wstring strMaxHP = std::to_wstring(statMaxHP);
std::wstring strMana = std::to_wstring(statMana);
std::wstring strMaxMana = std::to_wstring(statMaxMana);
std::wstring strStamina = std::to_wstring(statStamina);
std::wstring strMaxStamina = std::to_wstring(statMaxStamina);
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
// Calculate the percentages of current HP, Mana, and Stamina
float healthPercentage = static_cast<float>(statHP) / static_cast<float>(statMaxHP);
@ -333,14 +344,17 @@ public:
// Define the dimensions for the bars
int barWidth = 200; // Width of the bars
int barHeight = 10; // Height of the bars
int barHeight = 16; // Height of the bars
// Define the coordinates for the bars
int barX = 15; // Left coordinate of the bars
int barY_HP = 600; // Top coordinate of the HP bar
int barX = 245; // Left coordinate of the bars
int barY_HP = 728; // Top coordinate of the HP bar
int barY_Mana = barY_HP + barHeight + 4; // Top coordinate of the Mana bar with separator
int barY_Stamina = barY_Mana + barHeight + 4; // Top coordinate of the Stamina bar with separator
std::wstring life = strHP + L" / " + strMaxHP;
std::wstring mana = strMana + L" / " + strMaxMana;
std::wstring stamina = strStamina + L" / " + strMaxStamina;
// Calculate the filled widths of the bars
@ -351,23 +365,59 @@ public:
HWND diabloIIWnd = FindDiabloIIWindow();
// Draw the filled HP bar
// diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, 1, 7);
DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP
diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, 10, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP
diablo2::d2_win::draw_text(const_cast<wchar_t*>(life.c_str()), barX + 20, barY_HP + 15, stat.colorStatValue, 0);
// Draw the filled Mana bar
// diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 3, 7);
DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana
diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 156, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana
diablo2::d2_win::draw_text(const_cast<wchar_t*>(mana.c_str()), barX + 20, barY_Mana + 15, stat.colorStatValue, 0);
/*
// Define the number of separators
int numColors = 256;
int numColumns = 4;
int colorsPerColumn = numColors / numColumns;
int separatorHeight = 1; // Height of each separator
int columnOffset = 200; // Offset for each column
// Iterate over each column
for (int column = 0; column < numColumns; ++column) {
// Calculate the starting X coordinate for this column
int columnX = barX + (column * columnOffset);
// Draw the filled Mana bars for this column
for (int i = 0; i < colorsPerColumn; ++i) {
int colorIndex = column * colorsPerColumn + i;
int separatorY = barY_Mana + barHeight + i * (separatorHeight + barHeight);
// Draw the filled Mana bar
diablo2::d2_gfx::draw_filled_rect(columnX, separatorY, columnX + filledManaWidth, separatorY + barHeight, colorIndex, 255);
// Draw the index number at the same coordinates as the bar
std::wstring indexStr = std::to_wstring(colorIndex);
diablo2::d2_win::draw_text(const_cast<wchar_t*>(indexStr.c_str()), columnX - 20, separatorY, diablo2::UI_COLOR_DARK_GOLD, 0);
}
}
*/
// Draw the filled Stamina bar
// diablo2::d2_gfx::draw_filled_rect(barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, 9, 7);
DrawFilledRect(diabloIIWnd, barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, RGB(255, 255, 0)); // Green color for Stamina
// diablo2::d2_gfx::draw_filled_rect(barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, 12, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, RGB(255, 255, 0)); // Green color for Stamina
int statLevel = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(12), NULL);
int statLastExp = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(29), NULL);
int statNextExp = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(30), NULL);
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
}
@ -397,6 +447,7 @@ public:
menu::draw();
}
private:
static bool should_draw() {
return diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_INVENTORY) ||

View File

@ -249,7 +249,7 @@ static void draw_damage_labels() {
int _barHeight = GetPrivateProfileIntA("Options", "barHeight", 0, "./D2Tweaks.ini");
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 * 60, textY + _barHeight, 9, 7);
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * 60, textY + _barHeight, 9, 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;

View File

@ -34,7 +34,7 @@ void diablo2::d2_gfx::draw_image(structures::gfxdata* data, uint32_t x, uint32_t
}
void diablo2::d2_gfx::draw_filled_rect(int left , int top, int right, int bottom, ULONG color, ULONG transTbl) {
static wrap_func_std_import<void(int, int, int, int, ULONG, ULONG)> draw_boxed_text(10055, get_base());
void diablo2::d2_gfx::draw_filled_rect(int left , int top, int right, int bottom, DWORD color, int transTbl) {
static wrap_func_std_import<void(int, int, int, int, DWORD, int)> draw_boxed_text(10056, get_base());
draw_boxed_text(left, top, right, bottom, color, transTbl);
}

View File

@ -22,7 +22,11 @@ void diablo2::d2_win::draw_boxed_text(wchar_t* str, uint32_t x, uint32_t y, int3
draw_boxed_text(str, x, y, paletteIndex, transTbl, color);
}
int32_t diablo2::d2_win::D2Win_10034_MixRGB(uint8_t nRed, uint8_t nGreen, uint8_t nBlue) {
static wrap_func_fast_import<int32_t(uint8_t, uint8_t, uint8_t)> D2Win_10034_MixRGB(10034, get_base());
auto xColor = D2Win_10034_MixRGB(nRed, nGreen, nBlue);
return xColor;
}
void diablo2::d2_win::set_popup_properties(wchar_t* str, uint32_t x, uint32_t y, ui_color_t color, int32_t align) {
static wrap_func_fast_import<void(wchar_t*, uint32_t, uint32_t, int32_t, int32_t)> hover_text(10129, get_base());