Slightly better options menu.
This was SVN commit r14766.
This commit is contained in:
parent
e182b4ddd2
commit
a725266337
@ -1,4 +1,197 @@
|
|||||||
|
/**
|
||||||
|
* This array holds the data to populate the general section with.
|
||||||
|
* Data is in the form [Title, Tooltip, {ActionType:Action}, InputType].
|
||||||
|
*/
|
||||||
|
var options = {
|
||||||
|
"generalSetting":
|
||||||
|
[
|
||||||
|
["Windowed Mode", "Start 0 A.D. in windowed mode", {"config":"windowed"}, "boolean"],
|
||||||
|
["Background Pause", "Pause single player games when window loses focus", {"config":"pauseonfocusloss"}, "boolean"],
|
||||||
|
],
|
||||||
|
"graphicsSetting":
|
||||||
|
[
|
||||||
|
["Prefer GLSL", "Use OpenGL 2.0 shaders (recommended)", {"renderer":"PreferGLSL"}, "boolean"],
|
||||||
|
["Shadows", "Enable shadows", {"renderer":"Shadows"}, "boolean"],
|
||||||
|
["Particles", "Enable particles", {"renderer":"Particles"}, "boolean"],
|
||||||
|
["Show Sky", "Render Sky", {"renderer":"ShowSky"}, "boolean"],
|
||||||
|
["Unit Silhouettes", "Show outlines of units behind buildings", {"renderer":"Silhouettes"}, "boolean"],
|
||||||
|
["Shadow Flitering", "Smooth shadows", {"renderer":"ShadowPCF"}, "boolean"],
|
||||||
|
["HQ Waviness", "Use real normals for ocean-wave rendering, instead of applying them as a flat texture", {"renderer":"WaterNormal"}, "boolean"],
|
||||||
|
["Real Water Depth", "Use actual water depth in rendering calculations", {"renderer":"WaterRealDepth"}, "boolean"],
|
||||||
|
["Water Reflections", "Allow water to reflect a mirror image", {"renderer":"WaterReflection"}, "boolean"],
|
||||||
|
["Water Refraction", "Use a real water refraction map and not transparency", {"renderer":"WaterRefraction"}, "boolean"],
|
||||||
|
["Shore Foam", "Show foam on water near shore depending on water waviness", {"renderer":"WaterFoam"}, "boolean"],
|
||||||
|
["Shore Waves", "Show breaking waves on water near shore (Requires HQ Waviness)", {"renderer":"WaterCoastalWaves"}, "boolean"],
|
||||||
|
["Water Shadows", "Cast shadows on water", {"renderer":"WaterShadow"}, "boolean"],
|
||||||
|
],
|
||||||
|
"soundSetting":
|
||||||
|
[
|
||||||
|
["Master Gain", "Master audio gain", {"config":"sound.mastergain", "function":"Engine.SetMasterGain(Number(this.caption));"}, "number"],
|
||||||
|
["Music Gain", "In game music gain", {"config":"sound.musicgain", "function":"Engine.SetMusicGain(Number(this.caption));"}, "number"],
|
||||||
|
["Ambient Gain", "In game ambient sound gain", {"config":"sound.ambientgain", "function":"Engine.SetMusicGain(Number(this.caption));"}, "number"],
|
||||||
|
["Action Gain", "In game unit action sound gain", {"config":"sound.actiongain", "function":"Engine.SetMusicGain(Number(this.caption));"}, "number"],
|
||||||
|
["UI Gain", "UI sound gain", {"config":"sound.uigain", "function":"Engine.SetMusicGain(Number(this.caption));"}, "number"],
|
||||||
|
],
|
||||||
|
"lobbySetting":
|
||||||
|
[
|
||||||
|
["Chat Backlog", "Number of backlogged messages to load when joining the lobby", {"config":"lobby.history"}, "number"],
|
||||||
|
["Chat Timestamp", "Show time that messages are posted in the lobby chat", {"config":"lobby.chattimestamp"}, "boolean"],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
// WARNING: We assume a strict formatting of the XML and do minimal checking.
|
||||||
|
for each (var prefix in Object.keys(options))
|
||||||
|
{
|
||||||
|
var lastSize;
|
||||||
|
for (var i = 0; i < options[prefix].length; i++)
|
||||||
|
{
|
||||||
|
var body = Engine.GetGUIObjectByName(prefix + "[" + i + "]");
|
||||||
|
var label = Engine.GetGUIObjectByName(prefix + "Label[" + i + "]");
|
||||||
|
// Setup control.
|
||||||
|
setupControl(options[prefix][i], i, prefix);
|
||||||
|
// Setup label.
|
||||||
|
label.caption = options[prefix][i][0];
|
||||||
|
label.tooltip = options[prefix][i][1];
|
||||||
|
// Move each element to the correct place.
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
var newSize = new GUISize();
|
||||||
|
newSize.left = lastSize.left;
|
||||||
|
newSize.rright = lastSize.rright;
|
||||||
|
newSize.top = lastSize.bottom;
|
||||||
|
newSize.bottom = newSize.top + 25;
|
||||||
|
body.size = newSize;
|
||||||
|
lastSize = newSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastSize = body.size;
|
||||||
|
}
|
||||||
|
// Show element.
|
||||||
|
body.hidden = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Setup the apropriate control for a given option.
|
||||||
|
*
|
||||||
|
* @param option Structure containing the data to setup an option.
|
||||||
|
* @param prefix Prefix to use when accessing control, for example "generalSetting" when the tickbox name is generalSettingTickbox[i].
|
||||||
|
*/
|
||||||
|
function setupControl(option, i, prefix)
|
||||||
|
{
|
||||||
|
switch (option[3])
|
||||||
|
{
|
||||||
|
case "boolean":
|
||||||
|
var control = Engine.GetGUIObjectByName(prefix + "Tickbox[" + i + "]");
|
||||||
|
var checked;
|
||||||
|
var onPress = function(){};
|
||||||
|
// Different option action load and save differently, so this switch is needed.
|
||||||
|
for each (var action in Object.keys(option[2]))
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case "config":
|
||||||
|
// Load initial value if not yet loaded.
|
||||||
|
if (!checked || typeof checked != boolean)
|
||||||
|
checked = Engine.ConfigDB_GetValue("user", option[2][action]) === "true" ? true : false;
|
||||||
|
// Hacky macro to create the callback.
|
||||||
|
var callback = function(key)
|
||||||
|
{
|
||||||
|
return function()
|
||||||
|
{
|
||||||
|
Engine.ConfigDB_CreateValue("user", key, String(this.checked));
|
||||||
|
};
|
||||||
|
}(option[2][action]);
|
||||||
|
// Merge the new callback with any existing callbacks.
|
||||||
|
onPress = mergeFunctions(callback, onPress);
|
||||||
|
break;
|
||||||
|
case "renderer":
|
||||||
|
// Load initial value if not yet loaded.
|
||||||
|
if (!checked || typeof checked != boolean)
|
||||||
|
checked = eval("Engine.Renderer_Get" + option[2][action] + "Enabled()");
|
||||||
|
// Hacky macro to create the callback.
|
||||||
|
var callback = function(key)
|
||||||
|
{
|
||||||
|
return function()
|
||||||
|
{
|
||||||
|
eval("Engine.Renderer_Set" + key + "Enabled(" + this.checked + ")");
|
||||||
|
};
|
||||||
|
}(option[2][action]);
|
||||||
|
// Merge the new callback with any existing callbacks.
|
||||||
|
onPress = mergeFunctions(callback, onPress);
|
||||||
|
break;
|
||||||
|
case "function":
|
||||||
|
// This allows for doing low-level actions, like hiding/showing UI elements.
|
||||||
|
onPress = mergeFunctions(eval("function(){" + option[2][action] + "}"), onPress);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
warn("Unknown option source type '" + action + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Load final data to the control element.
|
||||||
|
control.checked = checked;
|
||||||
|
control.onPress = onPress;
|
||||||
|
break;
|
||||||
|
case "number":
|
||||||
|
// TODO: Slider
|
||||||
|
case "string":
|
||||||
|
var control = Engine.GetGUIObjectByName(prefix + "Input[" + i + "]");
|
||||||
|
var caption;
|
||||||
|
var onPress = function(){};
|
||||||
|
for each (var action in Object.keys(option[2]))
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case "config":
|
||||||
|
// Load initial value if not yet loaded.
|
||||||
|
if (!checked || typeof checked != boolean)
|
||||||
|
caption = Engine.ConfigDB_GetValue("user", option[2][action]);;
|
||||||
|
// Hacky macro to create the callback.
|
||||||
|
var callback = function(key)
|
||||||
|
{
|
||||||
|
return function()
|
||||||
|
{
|
||||||
|
Engine.ConfigDB_CreateValue("user", key, String(this.caption));
|
||||||
|
};
|
||||||
|
}(option[2][action]);
|
||||||
|
// Merge the new callback with any existing callbacks.
|
||||||
|
onPress = mergeFunctions(callback, onPress);
|
||||||
|
break;
|
||||||
|
case "function":
|
||||||
|
// This allows for doing low-level actions, like hiding/showing UI elements.
|
||||||
|
onPress = mergeFunctions(function(){eval(option[2][action])}, onPress);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
warn("Unknown option source type '" + action + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
control.caption = caption;
|
||||||
|
control.onPress = onPress;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
warn("Unknown option type '" + options[3] + "', assuming string. Valid types are 'number', 'string', or 'bool'.");
|
||||||
|
var control = Engine.GetGUIObjectByName(prefix + "Input[" + i + "]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
control.hidden = false;
|
||||||
|
control.tooltip = option[1];
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge two functions which don't expect arguments.
|
||||||
|
*
|
||||||
|
* @return Merged function.
|
||||||
|
*/
|
||||||
|
function mergeFunctions(function1, function2)
|
||||||
|
{
|
||||||
|
return function()
|
||||||
|
{
|
||||||
|
function1.apply(this);
|
||||||
|
function2.apply(this);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<objects>
|
<objects>
|
||||||
<script file="gui/common/functions_civinfo.js"/>
|
|
||||||
<script file="gui/options/options.js"/>
|
<script file="gui/options/options.js"/>
|
||||||
|
|
||||||
<!-- Add a translucent black background to fade out the menu page -->
|
<!-- Add a translucent black background to fade out the menu page -->
|
||||||
@ -16,104 +15,53 @@
|
|||||||
<!-- Settings Window -->
|
<!-- Settings Window -->
|
||||||
<object name="options" type="image" style="ModernDialog" size="50%-466 50%-316 50%+466 50%+316">
|
<object name="options" type="image" style="ModernDialog" size="50%-466 50%-316 50%+466 50%+316">
|
||||||
<object style="TitleText" type="text" size="50%-128 0%-16 50%+128 16">Game Options</object>
|
<object style="TitleText" type="text" size="50%-128 0%-16 50%+128 16">Game Options</object>
|
||||||
<object name="SystemSettings" type="image" sprite="ModernDarkBoxGold" size="16 16 316 100%-16">
|
<object name="GeneralSettings" type="image" sprite="ModernDarkBoxGold" size="16 16 312 100%-16">
|
||||||
<object style="TitleText" type="text" size="0 5 100% 25">System Settings</object>
|
<object style="TitleText" type="text" size="0 5 100% 25">General</object>
|
||||||
<object size="0 25 65% 50" type="text" style="ModernLabelText" text_align="right">Windowed Mode</object>
|
<repeat count="23">
|
||||||
<object name="WindowedCFGLate" size="70% 30 70%+25 55" type="checkbox" style="ModernTickBox">
|
<object name="generalSetting[n]" size="0 25 100% 50" hidden="true">
|
||||||
<action on="Load">Engine.ConfigDB_GetValue("user", "windowed") === "true" ? this.checked = true : this.checked = false;</action>
|
<object name="generalSettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="right"/>
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "windowed", String(this.checked));</action>
|
<object name="generalSettingTickbox[n]" size="70% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/>
|
||||||
</object>
|
<object name="generalSettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/>
|
||||||
<object size="0 50 65% 75" type="text" style="ModernLabelText" text_align="right">Background Pause</object>
|
</object>
|
||||||
<object name="PauseCFGNow" size="70% 55 70%+25 80" type="checkbox" style="ModernTickBox">
|
</repeat>
|
||||||
<action on="Load">Engine.ConfigDB_GetValue("user", "pauseonfocusloss") === "true" ? this.checked = true : this.checked = false;</action>
|
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "pauseonfocusloss", String(this.checked));</action>
|
|
||||||
</object>
|
|
||||||
</object>
|
</object>
|
||||||
<object name="GraphicsSettings" type="image" sprite="ModernDarkBoxGold" size="316 16 616 100%-16">
|
<object name="GraphicsSettings" type="image" sprite="ModernDarkBoxGold" size="320 16 612 100%-56">
|
||||||
<object style="TitleText" type="text" size="0 5 100% 25">Graphics Settings</object>
|
<object style="TitleText" type="text" size="0 5 100% 25">Graphics Settings</object>
|
||||||
<object size="0 25 65% 50" type="text" style="ModernLabelText" text_align="right">Enable Shadows</object>
|
<repeat count="21">
|
||||||
<object name="ShadowsCFG" size="70% 30 70%+25 55" type="checkbox" style="ModernTickBox">
|
<object name="graphicsSetting[n]" size="0 25 100% 50" hidden="true">
|
||||||
<action on="Load">this.checked = Engine.Renderer_GetShadowsEnabled();</action>
|
<object name="graphicsSettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="right"/>
|
||||||
<action on="Press">Engine.Renderer_SetShadowsEnabled(this.checked);</action>
|
<object name="graphicsSettingTickbox[n]" size="70% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/>
|
||||||
</object>
|
<object name="graphicsSettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/>
|
||||||
<object size="0 50 65% 75" type="text" style="ModernLabelText" text_align="right">Enable Shadow Filtering</object>
|
</object>
|
||||||
<object name="ShadowPCFCFGNow" size="70% 55 70%+25 80" type="checkbox" style="ModernTickBox">
|
</repeat>
|
||||||
<action on="Load">this.checked = Engine.Renderer_GetShadowPCFEnabled();</action>
|
|
||||||
<action on="Press">Engine.Renderer_SetShadowPCFEnabled(this.checked);</action>
|
|
||||||
</object>
|
|
||||||
</object>
|
</object>
|
||||||
<object name="SoundSettings" type="image" sprite="ModernDarkBoxGold" size="616 16 916 50%">
|
<object name="SoundSettings" type="image" sprite="ModernDarkBoxGold" size="620 16 916 50%-4">
|
||||||
<object style="TitleText" type="text" size="0 5 100% 25">Sound Settings</object>
|
<object style="TitleText" type="text" size="0 5 100% 25">Sound Settings</object>
|
||||||
<object size="0 25 65% 50" type="text" style="ModernLabelText" text_align="right">Master Gain</object>
|
<repeat count="10">
|
||||||
<object name="SMasterCFG" size="70% 25 70%+35 50" type="input" style="ModernInput">
|
<object name="soundSetting[n]" size="0 25 100% 50" hidden="true">
|
||||||
<action on="Load">this.caption = Engine.ConfigDB_GetValue("user", "sound.mastergain");</action>
|
<object name="soundSettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="right"/>
|
||||||
</object>
|
<object name="soundSettingTickbox[n]" size="70% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/>
|
||||||
<object size="70%+40 25 70%+85 50" type="button" style="StoneButton">Save
|
<object name="soundSettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/>
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "sound.mastergain", String(Engine.GetGUIObjectByName("SMasterCFG").caption));</action>
|
</object>
|
||||||
</object>
|
</repeat>
|
||||||
<object size="0 50 65% 75" type="text" style="ModernLabelText" text_align="right">Music Gain</object>
|
|
||||||
<object name="SMusicCFG" size="70% 50 70%+35 75" type="input" style="ModernInput">
|
|
||||||
<action on="Load">this.caption = Engine.ConfigDB_GetValue("user", "sound.musicgain");</action>
|
|
||||||
</object>
|
|
||||||
<object size="70%+40 25 70%+85 50" type="button" style="StoneButton">Save
|
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "sound.musicgain", String(Engine.GetGUIObjectByName("SMusicCFG").caption));</action>
|
|
||||||
</object>
|
|
||||||
</object>
|
</object>
|
||||||
<object name="LobbySettings" type="image" sprite="ModernDarkBoxGold" size="616 50% 916 100%-16">
|
<object name="LobbySettings" type="image" sprite="ModernDarkBoxGold" size="620 50%+4 916 100%-16">
|
||||||
<object style="TitleText" type="text" size="0 5 100% 25">Lobby Settings</object>
|
<object style="TitleText" type="text" size="0 5 100% 25">Lobby Settings</object>
|
||||||
<object size="0 25 65% 50" type="text" style="ModernLabelText" text_align="right">Amount of Chat History</object>
|
<repeat count="10">
|
||||||
<object name="LHistoryCFG" size="70% 25 70%+35 50" type="input" style="ModernInput">
|
<object name="lobbySetting[n]" size="0 25 100% 50" hidden="true">
|
||||||
<action on="Load">this.caption = Engine.ConfigDB_GetValue("user", "lobby.history");</action>
|
<object name="lobbySettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="right"/>
|
||||||
</object>
|
<object name="lobbySettingTickbox[n]" size="70% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/>
|
||||||
<object size="70%+40 25 70%+85 50" type="button" style="StoneButton">Save
|
<object name="lobbySettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/>
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "lobby.history", Engine.GetGUIObjectByName("LHistoryCFG").caption);</action>
|
</object>
|
||||||
</object>
|
</repeat>
|
||||||
<object size="0 50 65% 75" type="text" style="ModernLabelText" text_align="right">Show Chat Timestamp</object>
|
|
||||||
<object name="LChatTSCFG" size="70% 55 70%+25 80" type="checkbox" style="ModernTickBox">
|
|
||||||
<action on="Load">this.checked = Engine.ConfigDB_GetValue("user", "lobby.chattimestamp") === "false" ? this.checked = true : this.checked = false;</action>
|
|
||||||
<action on="Press">Engine.ConfigDB_CreateValue("user", "lobby.chattimestamp", String(this.checked));</action>
|
|
||||||
</object>
|
|
||||||
</object>
|
</object>
|
||||||
<!--
|
<object type="button" style="StoneButton" size="320 100%-48 50%-4 100%-16">
|
||||||
Settings / shadows
|
|
||||||
<object size="0 10 100%-80 35" type="text" style="RightLabelText" ghost="true">Enable Shadows</object>
|
|
||||||
<object name="shadowsCheckbox" size="100%-56 15 100%-30 40" type="checkbox" style="StoneCrossBox" checked="true">
|
|
||||||
<action on="Load">this.checked = Engine.Renderer_GetShadowsEnabled();</action>
|
|
||||||
<action on="Press">Engine.Renderer_SetShadowsEnabled(this.checked);</action>
|
|
||||||
</object>
|
|
||||||
Settings / Shadow PCF
|
|
||||||
<object size="0 35 100%-80 60" type="text" style="RightLabelText" ghost="true">Enable Shadow Filtering</object>
|
|
||||||
<object name="shadowPCFCheckbox" size="100%-56 40 100%-30 65" type="checkbox" style="StoneCrossBox" checked="true">
|
|
||||||
<action on="Load">this.checked = Engine.Renderer_GetShadowPCFEnabled();</action>
|
|
||||||
<action on="Press">Engine.Renderer_SetShadowPCFEnabled(this.checked);</action>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
Settings / Water
|
|
||||||
<object size="0 60 100%-80 85" type="text" style="RightLabelText" ghost="true">Enable Water Reflections</object>
|
|
||||||
<object name="fancyWaterCheckbox" size="100%-56 65 100%-30 90" type="checkbox" style="StoneCrossBox" checked="true">
|
|
||||||
<action on="Load">this.checked = Engine.Renderer_GetWaterNormalEnabled();</action>
|
|
||||||
<action on="Press">Engine.Renderer_SetWaterNormalEnabled(this.checked);</action>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
Settings / Music
|
|
||||||
<object size="0 60 100%-80 85" type="text" style="RightLabelText" ghost="true">Enable Music</object>
|
|
||||||
<object size="100%-56 65 100%-30 90" type="checkbox" style="StoneCrossBox" checked="true">
|
|
||||||
<action on="Press">if (this.checked) startMusic(); else stopMusic();</action>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
Settings / Dev Overlay
|
|
||||||
<object size="0 110 100%-80 135" type="text" style="RightLabelText" ghost="true">Developer Overlay</object>
|
|
||||||
<object size="100%-56 115 100%-30 140" type="checkbox" style="StoneCrossBox" checked="false">
|
|
||||||
<action on="Press">toggleDeveloperOverlay();</action>
|
|
||||||
</object>
|
|
||||||
-->
|
|
||||||
<object type="button" style="StoneButton" size="50%+16 100%-64 50%+144 100%-32">
|
|
||||||
Cancel
|
|
||||||
<action on="Press">Engine.PopGuiPage();</action>
|
|
||||||
</object>
|
|
||||||
<object type="button" style="StoneButton" size="50%-144 100%-64 50%-16 100%-32">
|
|
||||||
Save
|
Save
|
||||||
<action on="Press">Engine.ConfigDB_WriteFile("user", "config/user.cfg");Engine.PopGuiPage();</action>
|
<action on="Press">Engine.ConfigDB_WriteFile("user", "config/user.cfg");Engine.PopGuiPage();</action>
|
||||||
</object>
|
</object>
|
||||||
|
<object type="button" style="StoneButton" size="50%+4 100%-48 612 100%-16">
|
||||||
|
Cancel
|
||||||
|
<action on="Press">Engine.PopGuiPage();</action>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</objects>
|
</objects>
|
||||||
|
@ -123,11 +123,11 @@ static void LoadGlobals()
|
|||||||
CFG_GET_VAL("sound.actiongain", Float, actionGain);
|
CFG_GET_VAL("sound.actiongain", Float, actionGain);
|
||||||
CFG_GET_VAL("sound.uigain", Float, uiGain);
|
CFG_GET_VAL("sound.uigain", Float, uiGain);
|
||||||
|
|
||||||
g_SoundManager->SetMasterGain( gain );
|
g_SoundManager->SetMasterGain(gain);
|
||||||
g_SoundManager->SetMusicGain( musicGain );
|
g_SoundManager->SetMusicGain(musicGain);
|
||||||
g_SoundManager->SetAmbientGain( ambientGain );
|
g_SoundManager->SetAmbientGain(ambientGain);
|
||||||
g_SoundManager->SetActionGain( actionGain );
|
g_SoundManager->SetActionGain(actionGain);
|
||||||
g_SoundManager->SetUIGain( uiGain );
|
g_SoundManager->SetUIGain(uiGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ protected:
|
|||||||
bool m_AmbientPaused;
|
bool m_AmbientPaused;
|
||||||
bool m_ActionPaused;
|
bool m_ActionPaused;
|
||||||
bool m_RunningPlaylist;
|
bool m_RunningPlaylist;
|
||||||
bool m_PlayingPlaylist;
|
bool m_PlayingPlaylist;
|
||||||
bool m_LoopingPlaylist;
|
bool m_LoopingPlaylist;
|
||||||
|
|
||||||
long m_PlaylistGap;
|
long m_PlaylistGap;
|
||||||
long m_DistressErrCount;
|
long m_DistressErrCount;
|
||||||
@ -135,8 +135,8 @@ public:
|
|||||||
long GetBufferCount();
|
long GetBufferCount();
|
||||||
long GetBufferSize();
|
long GetBufferSize();
|
||||||
|
|
||||||
void PlayAsMusic( const VfsPath& itemPath, bool looping );
|
void PlayAsMusic( const VfsPath& itemPath, bool looping);
|
||||||
void PlayAsAmbient( const VfsPath& itemPath, bool looping );
|
void PlayAsAmbient( const VfsPath& itemPath, bool looping);
|
||||||
void PlayAsUI(const VfsPath& itemPath, bool looping);
|
void PlayAsUI(const VfsPath& itemPath, bool looping);
|
||||||
void PlayAsGroup(const VfsPath& groupPath, CVector3D sourcePos, entity_id_t source, bool ownedSound);
|
void PlayAsGroup(const VfsPath& groupPath, CVector3D sourcePos, entity_id_t source, bool ownedSound);
|
||||||
|
|
||||||
@ -152,16 +152,17 @@ public:
|
|||||||
void PauseAction (bool pauseIt);
|
void PauseAction (bool pauseIt);
|
||||||
void SetAmbientItem(ISoundItem* anItem);
|
void SetAmbientItem(ISoundItem* anItem);
|
||||||
|
|
||||||
protected:
|
|
||||||
void InitListener();
|
|
||||||
Status AlcInit();
|
|
||||||
void SetMusicItem(ISoundItem* anItem);
|
|
||||||
void SetMasterGain(float gain);
|
void SetMasterGain(float gain);
|
||||||
void SetMusicGain(float gain);
|
void SetMusicGain(float gain);
|
||||||
void SetAmbientGain(float gain);
|
void SetAmbientGain(float gain);
|
||||||
void SetActionGain(float gain);
|
void SetActionGain(float gain);
|
||||||
void SetUIGain(float gain);
|
void SetUIGain(float gain);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitListener();
|
||||||
|
Status AlcInit();
|
||||||
|
void SetMusicItem(ISoundItem* anItem);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSoundManager(CSoundManager* UNUSED(other)){};
|
CSoundManager(CSoundManager* UNUSED(other)){};
|
||||||
};
|
};
|
||||||
|
@ -84,6 +84,35 @@ namespace JSI_Sound
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
|
||||||
|
{
|
||||||
|
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager )
|
||||||
|
sndManager->SetMasterGain(gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
|
||||||
|
{
|
||||||
|
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager )
|
||||||
|
sndManager->SetMusicGain(gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
|
||||||
|
{
|
||||||
|
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager )
|
||||||
|
sndManager->SetAmbientGain(gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
|
||||||
|
{
|
||||||
|
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager )
|
||||||
|
sndManager->SetActionGain(gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
|
||||||
|
{
|
||||||
|
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager )
|
||||||
|
sndManager->SetUIGain(gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -96,6 +125,11 @@ namespace JSI_Sound
|
|||||||
void ClearPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
void ClearPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
||||||
void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
||||||
void StartMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
void StartMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
|
||||||
|
void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
|
||||||
|
void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
|
||||||
|
void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
|
||||||
|
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
|
||||||
|
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -111,6 +145,11 @@ namespace JSI_Sound
|
|||||||
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayUISound>("PlayUISound");
|
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayUISound>("PlayUISound");
|
||||||
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayAmbientSound>("PlayAmbientSound");
|
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayAmbientSound>("PlayAmbientSound");
|
||||||
scriptInterface.RegisterFunction<bool, &MusicPlaying>("MusicPlaying");
|
scriptInterface.RegisterFunction<bool, &MusicPlaying>("MusicPlaying");
|
||||||
|
scriptInterface.RegisterFunction<void, float, &SetMasterGain>("SetMasterGain");
|
||||||
|
scriptInterface.RegisterFunction<void, float, &SetMusicGain>("SetMusicGain");
|
||||||
|
scriptInterface.RegisterFunction<void, float, &SetAmbientGain>("SetAmbientGain");
|
||||||
|
scriptInterface.RegisterFunction<void, float, &SetActionGain>("SetActionGain");
|
||||||
|
scriptInterface.RegisterFunction<void, float, &SetUIGain>("SetUIGain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user