Skip to content

Commit

Permalink
update 1.4.2.1 (#34)
Browse files Browse the repository at this point in the history
* fixed: null check to avoid ctd when doing work with the form ids
inside the menus
* added: seperate alpha/transparency settings for current items, current
  shout, slot count and slot item name (HUD Graphic>Transparency)
* added: seperate color setting for current items (applies to current
  shout as well), slot count and slot item name (HUD Graphic>Color)
* adjusted: do no add items or text to draw list if alpha is 0
  • Loading branch information
mlthelama authored Apr 5, 2023
2 parents df5f7fd + 9da0b1b commit c1dac28
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)

set(NAME "LamasTinyHUD")
set(VERSION 1.4.1.0)
set(VERSION 1.4.2.1)

# ---- Options ----

Expand Down
84 changes: 81 additions & 3 deletions mcm/Config/LamasTinyHUD/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -997,10 +997,49 @@
}
},
{
"id": "uTextTransparency:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_Transparency_Text_OptionText",
"id": "uCurrentItemsTransparency:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_Transparency_CurrentItemsText_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_Transparency_Text_InfoText",
"help": "$LamasTinyHUD_GraphicSetting_Transparency_CurrentItemsText_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"id": "uCurrentShoutTransparency:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_Transparency_CurrentShoutText_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_Transparency_CurrentShoutText_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"id": "uSlotCountTransparency:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_Transparency_SlotCountText_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_Transparency_SlotCountText_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"id": "uSlotItemNameTransparency:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_Transparency_SlotItemNameText_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_Transparency_SlotItemNameText_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
Expand Down Expand Up @@ -1178,6 +1217,45 @@
"sourceType": "ModSettingInt"
}
},
{
"id": "uSlotItemRed:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_SlotItemRed_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_SlotItemRed_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"id": "uSlotItemGreen:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_SlotItemGreen_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_SlotItemGreen_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"id": "uSlotItemBlue:GraphicSetting",
"text": "$LamasTinyHUD_GraphicSetting_SlotItemBlue_OptionText",
"type": "slider",
"help": "$LamasTinyHUD_GraphicSetting_SlotItemBlue_InfoText",
"valueOptions": {
"min": 0,
"max": 255,
"step": 1,
"formatString": "{0}",
"sourceType": "ModSettingInt"
}
},
{
"text": "$LamasTinyHUD_GraphicSetting_Misc",
"type": "header"
Expand Down
8 changes: 7 additions & 1 deletion mcm/Config/LamasTinyHUD/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,20 @@ uBackgroundTransparency = 255
uBackgroundIconTransparency = 255
uIconTransparency = 125
uKeyTransparency = 255
uTextTransparency = 255
uCurrentItemsTransparency = 255
uCurrentShoutTransparency = 255
uSlotCountTransparency = 255
uSlotItemNameTransparency = 255
uIconTransparencyBlocked = 50
uCurrentItemsRed = 255
uCurrentItemsGreen = 255
uCurrentItemsBlue = 255
uSlotCountRed = 255
uSlotCountGreen = 255
uSlotCountBlue = 255
uSlotItemRed = 255
uSlotItemGreen = 255
uSlotItemBlue = 255
fSlotCountTextFontSize = 20
fCurrentItemsFontSize = 20
uSlotButtonFeedback = 175
Expand Down
Binary file modified mcm/Interface/Translations/LamasTinyHUD_english.txt
Binary file not shown.
1 change: 0 additions & 1 deletion src/PCH.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#define STB_IMAGE_IMPLEMENTATION
#define IMGUI_DEFINE_MATH_OPERATORS
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
Expand Down
10 changes: 9 additions & 1 deletion src/handle/data/page/position_draw_setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ namespace handle {
uint32_t background_icon_transparency = ui::draw_full;
uint32_t icon_transparency = ui::draw_full;
uint32_t key_transparency = ui::draw_full;
uint32_t text_transparency = ui::draw_full;
uint32_t slot_count_transparency = ui::draw_full;
uint32_t slot_item_name_transparency = ui::draw_full;

uint32_t slot_count_red = ui::draw_full;
uint32_t slot_count_green = ui::draw_full;
uint32_t slot_count_blue = ui::draw_full;
uint32_t slot_item_red = ui::draw_full;
uint32_t slot_item_green = ui::draw_full;
uint32_t slot_item_blue = ui::draw_full;

float offset_slot_x = 0.f;
float offset_slot_y = 0.f;
Expand Down
11 changes: 10 additions & 1 deletion src/handle/page_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ namespace handle {
draw->background_icon_transparency = mcm::get_background_icon_transparency();
draw->icon_transparency = mcm::get_icon_transparency();
draw->key_transparency = mcm::get_key_transparency();
draw->text_transparency = mcm::get_text_transparency();
draw->slot_count_transparency = mcm::get_slot_count_transparency();
draw->slot_item_name_transparency = mcm::get_slot_item_name_transparency();

draw->slot_count_red = mcm::get_slot_count_red();
draw->slot_count_green = mcm::get_slot_count_green();
draw->slot_count_blue = mcm::get_slot_count_blue();
draw->slot_item_red = mcm::get_slot_item_red();
draw->slot_item_green = mcm::get_slot_item_green();
draw->slot_item_blue = mcm::get_slot_item_blue();

draw->alpha_slot_animation = mcm::get_alpha_slot_animation();
draw->duration_slot_animation = mcm::get_duration_slot_animation();

Expand Down
10 changes: 10 additions & 0 deletions src/processing/game_menu_setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

namespace processing {
void game_menu_setting::elden_souls_config(RE::TESForm* a_form, position_type a_position, bool a_overwrite) {
if (!a_form) {
logger::warn("form is null. return."sv);
return;
}

std::vector<data_helper*> data;

write_notification(fmt::format("Elden Souls Config, Position {}, overwrite {}"sv,
Expand Down Expand Up @@ -66,6 +71,11 @@ namespace processing {
logger::trace("Setting done. return.");
}
void game_menu_setting::default_config(RE::TESForm*& a_form, position_type a_position_type, bool a_left) {
if (!a_form) {
logger::warn("form is null. return."sv);
return;
}

const auto two_handed = util::helper::is_two_handed(a_form);
if (two_handed && a_left) {
auto log_string = fmt::format("Going to Ignore {}, because Two Handed {} and Left {}",
Expand Down
7 changes: 6 additions & 1 deletion src/processing/set_setting_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ namespace processing {
logger::trace("done equip for first set"sv);
}

void set_setting_data::clear_hands() {
[[maybe_unused]] void set_setting_data::clear_hands() {
logger::trace("clear hands"sv);
auto player = RE::PlayerCharacter::GetSingleton();
auto equip_manager = RE::ActorEquipManager::GetSingleton();
Expand Down Expand Up @@ -624,6 +624,11 @@ namespace processing {
}

void set_setting_data::default_remove(RE::TESForm* a_form) {
if (!a_form) {
logger::warn("form is null. return."sv);
return;
}

auto page_handle = handle::page_handle::get_singleton();
for (auto pages = page_handle->get_pages(); auto& [page, page_settings] : pages) {
for (auto [position, page_setting] : page_settings) {
Expand Down
2 changes: 1 addition & 1 deletion src/processing/set_setting_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace processing {
static void set_active_and_equip(handle::page_handle*& a_page_handle);
static void process_config_data();
static void write_empty_config_and_init_active();
static void clear_hands();
[[maybe_unused]] static void clear_hands();
static void block_location(handle::position_setting* a_position_setting, bool a_condition);
static void look_for_ammo(bool a_crossbow);
//easier to have both, first only needed to get the page, position. the second, so it is easier to have the form
Expand Down
30 changes: 26 additions & 4 deletions src/setting/mcm_setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ namespace config {
static uint32_t background_icon_transparency;
static uint32_t icon_transparency;
static uint32_t key_transparency;
static uint32_t text_transparency;
static uint32_t current_items_transparency;
static uint32_t current_shout_transparency;
static uint32_t slot_count_transparency;
static uint32_t slot_item_name_transparency;
static uint32_t icon_transparency_blocked;
static float slot_count_text_font_size;
static float current_items_font_size;
Expand All @@ -63,6 +66,9 @@ namespace config {
static uint32_t slot_count_red;
static uint32_t slot_count_green;
static uint32_t slot_count_blue;
static uint32_t slot_item_red;
static uint32_t slot_item_green;
static uint32_t slot_item_blue;
static uint32_t slot_button_feedback;
static bool draw_current_items_text;
static bool draw_item_name_text;
Expand Down Expand Up @@ -177,7 +183,14 @@ namespace config {
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uBackgroundIconTransparency", 175));
icon_transparency = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uIconTransparency", 125));
key_transparency = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uKeyTransparency", 225));
text_transparency = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uTextTransparency", 255));
current_items_transparency =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uCurrentItemsTransparency", 255));
current_shout_transparency =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uCurrentShoutTransparency", 255));
slot_count_transparency =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotCountTransparency", 255));
slot_item_name_transparency =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotItemNameTransparency", 255));
icon_transparency_blocked =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uIconTransparencyBlocked", 50));
slot_count_text_font_size =
Expand All @@ -191,6 +204,10 @@ namespace config {
slot_count_red = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotCountRed", 255));
slot_count_green = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotCountGreen", 255));
slot_count_blue = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotCountBlue", 255));
slot_item_red = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotItemRed", 255));
slot_item_green = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotItemGreen", 255));
slot_item_blue = static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotItemBlue", 255));

slot_button_feedback =
static_cast<uint32_t>(mcm.GetLongValue("GraphicSetting", "uSlotButtonFeedback", 150));
draw_current_items_text = mcm.GetBoolValue("GraphicSetting", "bDrawCurrentItemsText", true);
Expand Down Expand Up @@ -302,7 +319,10 @@ namespace config {
uint32_t mcm_setting::get_background_icon_transparency() { return background_icon_transparency; }
uint32_t mcm_setting::get_icon_transparency() { return icon_transparency; }
uint32_t mcm_setting::get_key_transparency() { return key_transparency; }
uint32_t mcm_setting::get_text_transparency() { return text_transparency; }
uint32_t mcm_setting::get_current_items_transparency() { return current_items_transparency; }
uint32_t mcm_setting::get_current_shout_transparency() { return current_shout_transparency; }
uint32_t mcm_setting::get_slot_count_transparency() { return slot_count_transparency; }
uint32_t mcm_setting::get_slot_item_name_transparency() { return slot_item_name_transparency; }
uint32_t mcm_setting::get_icon_transparency_blocked() { return icon_transparency_blocked; }
float mcm_setting::get_slot_count_text_font_size() { return slot_count_text_font_size * master_scale; }
float mcm_setting::get_current_items_font_size() { return current_items_font_size * master_scale; }
Expand All @@ -313,6 +333,9 @@ namespace config {
uint32_t mcm_setting::get_slot_count_red() { return slot_count_red; }
uint32_t mcm_setting::get_slot_count_green() { return slot_count_green; }
uint32_t mcm_setting::get_slot_count_blue() { return slot_count_blue; }
uint32_t mcm_setting::get_slot_item_red() { return slot_item_red; }
uint32_t mcm_setting::get_slot_item_green() { return slot_item_green; }
uint32_t mcm_setting::get_slot_item_blue() { return slot_item_blue; }
bool mcm_setting::get_draw_current_items_text() { return draw_current_items_text; }
uint32_t mcm_setting::get_slot_button_feedback() { return slot_button_feedback; }
bool mcm_setting::get_draw_item_name_text() { return draw_item_name_text; }
Expand All @@ -322,7 +345,6 @@ namespace config {
float mcm_setting::get_item_name_font_size() { return item_name_font_size; }
bool mcm_setting::get_draw_page_id() { return draw_page_id; }


uint32_t mcm_setting::get_alpha_slot_animation() { return alpha_slot_animation; }
float mcm_setting::get_duration_slot_animation() { return duration_slot_animation; }

Expand Down
9 changes: 8 additions & 1 deletion src/setting/mcm_setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ namespace config {
static uint32_t get_background_icon_transparency();
static uint32_t get_icon_transparency();
static uint32_t get_key_transparency();
static uint32_t get_text_transparency();
static uint32_t get_current_items_transparency();
static uint32_t get_current_shout_transparency();
static uint32_t get_slot_count_transparency();
static uint32_t get_slot_item_name_transparency();
static uint32_t get_icon_transparency_blocked();
static float get_slot_count_text_font_size();
static float get_current_items_font_size();
Expand All @@ -65,6 +68,10 @@ namespace config {
static uint32_t get_slot_count_red();
static uint32_t get_slot_count_green();
static uint32_t get_slot_count_blue();
static uint32_t get_slot_item_red();
static uint32_t get_slot_item_green();
static uint32_t get_slot_item_blue();

static uint32_t get_slot_button_feedback();
static bool get_draw_current_items_text();
static bool get_draw_item_name_text();
Expand Down
Loading

0 comments on commit c1dac28

Please sign in to comment.