diff --git a/docs/article-layouts-v2.md b/docs/article-layouts-v2.md index 5110954e..70439212 100644 --- a/docs/article-layouts-v2.md +++ b/docs/article-layouts-v2.md @@ -164,6 +164,8 @@ color = {r = 160, g = 240, b = 2, a = 255 } size = { x = 10.0, y = 10.0 } ``` +Soulsy ships with the indicator used above. It looks like a water droplet. + ### Meter elements Slot layouts can optionally include a *meter* display, for graphically showing enchantment charge or torch burn time. The meaning of the meter depends on the item being shown, and SoulsyHUD does its best to guess what should be shown for an item. For example, a meter on the shouts and powers HUD slot would show shout cooldown time if that's relevant. @@ -172,7 +174,6 @@ Right now SoulsyHUD supports three flavors of meters: 1. A rectangular meter built from two SVGs, one for the background and one to show fill level. 2. A rectangular meter built from one background SVG and a fill color. -3. __NOT YET FINISHED:__ Circular meters, with a background SVG, a fill color, and angles for 0% and 100%. You can draw a full circle around a slot or a partial arc. Elliptical curves aren't supported yet. (Sending cookies or coffee to the mod author might help with this feature request.) Rectangular meters are drawn as _horizontal_ bars filling from left to right, then rotated by the angle you specify. All angles are given in degrees. 0° means no rotation. 90° is a vertical meter, with full being at the top. You can specify any degree of rotation you want: if your layout uses equilateral triangles, you can rotate a meter 60° to make it align with an edge. @@ -191,12 +192,13 @@ size = { x = 100.0, y = 20.0 } color = { r = 255, g = 255, b = 255, a = 255 } [left.meter.fill] # the svg drawn to show the fill +# set this to empty string to re-use the empty svg svg = "meter_bar_filled.svg" size = { x = 98.0, y = 16.0 } color = { r = 59, g = 106, b = 249, a = 200 } ``` -Meter elements are rotated around their centers. You will likely need to play with the offset until a rotated meter is positioned exactly where you want. Remember to specify sizes as if the meter were *horizontal*, filling from left to right. Then rotate it to match your other layout elements. +Meter elements are rotated around their centers. You will likely need to play with the offset until a rotated meter is positioned exactly where you want. Remember to specify sizes as if the meter were *horizontal*, filling from left to right. Then rotate it to match your other layout elements. Look at the layouts that come with Soulsy to see examples of meters with different rotations and fills. ## Slot elements diff --git a/installer/images/layouts-default.jpg b/installer/images/layouts-default.jpg index 3d89f89b..a2154fa8 100644 Binary files a/installer/images/layouts-default.jpg and b/installer/images/layouts-default.jpg differ diff --git a/installer/images/layouts-minimal.jpg b/installer/images/layouts-minimal.jpg index 0392ed19..ae223cf9 100644 Binary files a/installer/images/layouts-minimal.jpg and b/installer/images/layouts-minimal.jpg differ diff --git a/installer/images/layouts-text-only.jpeg b/installer/images/layouts-text-only.jpeg new file mode 100644 index 00000000..d684668a Binary files /dev/null and b/installer/images/layouts-text-only.jpeg differ diff --git a/src/controller/control.rs b/src/controller/control.rs index b8294cd1..b26d75fc 100644 --- a/src/controller/control.rs +++ b/src/controller/control.rs @@ -946,7 +946,7 @@ impl Controller { let kind = item.kind(); cxx::let_cxx_string!(form_spec = item.form_string()); cxx::let_cxx_string!(name = item.name()); - log::info!("about to equip this item: slot={:?}; {}", which, item); + log::debug!("about to equip this item: slot={:?}; {}", which, item); if kind.is_magic() || kind.left_hand_ok() || kind.right_hand_ok() { equipWeapon(&form_spec, which, &name); @@ -1167,7 +1167,7 @@ impl Controller { self.update_slot(HudElement::Left, &HudItem::default()); return changed; } else if treat_as_two_hander && left { - log::info!("treat_as_two_hander + left detected; item={item}"); + log::debug!("treat_as_two_hander + left detected; item={item}"); // TODO The left hud slot should be cleared and the left hand unequipped. // but I'm also not sure we ever get here. return false; diff --git a/src/data/huditem.rs b/src/data/huditem.rs index 45c70178..5197d4b3 100644 --- a/src/data/huditem.rs +++ b/src/data/huditem.rs @@ -83,11 +83,20 @@ impl RelevantExtraData { pub fn randomize() -> Self { let has_charge = rand::random::() > 0.5; let max_charge = if has_charge { + rand::random::() * 3000.0 } else { 0.0 }; + let charge = rand::random::() * max_charge; let has_time_left = rand::random::() > 0.5; + let max_time = if has_charge { + rand::random::() * 120.0 + } else { + 0.0 + }; + let time_left = rand::random::() * max_time; + let is_poisoned = rand::random::() > 0.5; Self { @@ -304,10 +313,18 @@ impl HudItem { self.shout_cooldown = extra.time_left; self.meter_level = 0.0; } else { - self.meter_level = extra.time_left * 100.0 / self.shout_cooldown; + if self.shout_cooldown == 0.0 { + self.meter_level = 0.0; + } else { + self.meter_level = extra.time_left * 100.0 / self.shout_cooldown; + } } } else { - self.meter_level = extra.time_left * 100.0 / extra.max_time; + if extra.max_time == 0.0 { + self.meter_level = 0.0; + } else { + self.meter_level = extra.time_left * 100.0 / extra.max_time; + } } }