music: use vanilla's volume percentage conversion

This commit is contained in:
Max Weber
2021-07-18 17:01:54 -06:00
parent 48c6434e6d
commit 8f6082081f

View File

@@ -748,7 +748,7 @@ public class MusicPlugin extends Plugin
s.update();
s.getChannel().setWindowSlider(s);
}
if (ev.getScriptId() == ScriptID.TOPLEVEL_REDRAW && musicConfig.granularSliders())
{
// we have to set the var to our value so toplevel_redraw doesn't try to set
@@ -857,11 +857,12 @@ public class MusicPlugin extends Plugin
windowSlider.update();
}
}
public void updateVar()
{
int val = getValue();
client.getVarps()[this.var.getId()] = val * 100 / this.max;
int varVal = Math.round((float) val / (max / 100.f));
client.getVarps()[this.var.getId()] = varVal;
}
public void shutDown()