Merge pull request #3944 from pchote/sound-fix
Fix bogus sound attenuation.
This commit is contained in:
@@ -32,14 +32,8 @@ namespace OpenRA
|
||||
public static MouseButtonPreference mouseButtonPreference = new MouseButtonPreference();
|
||||
|
||||
public static ModData modData;
|
||||
static WorldRenderer worldRenderer;
|
||||
public static float Zoom
|
||||
{
|
||||
get { return worldRenderer.Viewport.Zoom; }
|
||||
set { worldRenderer.Viewport.Zoom = value; }
|
||||
}
|
||||
|
||||
public static Settings Settings;
|
||||
static WorldRenderer worldRenderer;
|
||||
|
||||
internal static OrderManager orderManager;
|
||||
static Server.Server server;
|
||||
@@ -141,7 +135,7 @@ namespace OpenRA
|
||||
// worldRenderer is null during the initial install/download screen
|
||||
if (worldRenderer != null)
|
||||
{
|
||||
Game.Renderer.BeginFrame(worldRenderer.Viewport.TopLeft.ToFloat2(), Zoom);
|
||||
Game.Renderer.BeginFrame(worldRenderer.Viewport.TopLeft.ToFloat2(), worldRenderer.Viewport.Zoom);
|
||||
Sound.SetListenerPosition(worldRenderer.Position(worldRenderer.Viewport.CenterLocation));
|
||||
worldRenderer.Draw();
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ namespace OpenRA
|
||||
public void SetListenerPosition(WPos position)
|
||||
{
|
||||
// Move the listener out of the plane so that sounds near the middle of the screen aren't too positional
|
||||
Al.alListener3f(Al.AL_POSITION, position.X, position.Y, position.Z + 5*1024);
|
||||
Al.alListener3f(Al.AL_POSITION, position.X, position.Y, position.Z + 2133);
|
||||
|
||||
var orientation = new[] { 0f, 0f, 1f, 0f, -1f, 0f };
|
||||
Al.alListenerfv(Al.AL_ORIENTATION, ref orientation[0]);
|
||||
@@ -682,9 +682,8 @@ namespace OpenRA
|
||||
Al.alSourcei(source, Al.AL_LOOPING, looping ? Al.AL_TRUE : Al.AL_FALSE);
|
||||
Al.alSourcei(source, Al.AL_SOURCE_RELATIVE, relative ? 1 : 0);
|
||||
|
||||
var width = Game.Renderer.Resolution.Width / (Game.Zoom * Game.CellSize);
|
||||
Al.alSourcef(source, Al.AL_REFERENCE_DISTANCE, width / 8);
|
||||
Al.alSourcef(source, Al.AL_MAX_DISTANCE, 2 * width);
|
||||
Al.alSourcef(source, Al.AL_REFERENCE_DISTANCE, 6826);
|
||||
Al.alSourcef(source, Al.AL_MAX_DISTANCE, 136533);
|
||||
Al.alSourcePlay(source);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Mods.RA.Widgets;
|
||||
using OpenRA.Mods.RA.Widgets.Logic;
|
||||
@@ -32,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
World world;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncSettingsLogic(Widget widget, World world, Action onExit)
|
||||
public CncSettingsLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
|
||||
{
|
||||
this.world = world;
|
||||
var panel = widget.Get("SETTINGS_PANEL");
|
||||
@@ -90,7 +91,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
pixelDoubleCheckbox.OnClick = () =>
|
||||
{
|
||||
graphicsSettings.PixelDouble ^= true;
|
||||
Game.Zoom = graphicsSettings.PixelDouble ? 2 : 1;
|
||||
worldRenderer.Viewport.Zoom = graphicsSettings.PixelDouble ? 2 : 1;
|
||||
};
|
||||
|
||||
var showShellmapCheckbox = generalPane.Get<CheckboxWidget>("SHOW_SHELLMAP");
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
@@ -16,18 +17,24 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
class IngameMenuLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public IngameMenuLogic(Widget widget, World world, Action onExit)
|
||||
public IngameMenuLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
|
||||
{
|
||||
widget.Get<ButtonWidget>("DISCONNECT").OnClick = () =>
|
||||
{
|
||||
onExit();
|
||||
LeaveGame(world);
|
||||
};
|
||||
|
||||
widget.Get<ButtonWidget>("SETTINGS").OnClick = () =>
|
||||
{
|
||||
widget.Visible = false;
|
||||
Ui.OpenWindow("SETTINGS_MENU", new WidgetArgs { { "onExit", () => { widget.Visible = true; } } });
|
||||
Ui.OpenWindow("SETTINGS_MENU", new WidgetArgs()
|
||||
{
|
||||
{ "onExit", () => widget.Visible = true },
|
||||
{ "worldRenderer", worldRenderer },
|
||||
});
|
||||
};
|
||||
|
||||
widget.Get<ButtonWidget>("MUSIC").OnClick = () =>
|
||||
{
|
||||
widget.Visible = false;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
widget.Get<ButtonWidget>("MAINMENU_BUTTON_SETTINGS").OnClick = () =>
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Ui.OpenWindow("SETTINGS_MENU", new WidgetArgs()
|
||||
Game.OpenWindow("SETTINGS_MENU", new WidgetArgs()
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Main }
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
@@ -24,7 +25,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
SoundDevice soundDevice;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public SettingsMenuLogic(Action onExit)
|
||||
public SettingsMenuLogic(Action onExit, WorldRenderer worldRenderer)
|
||||
{
|
||||
bg = Ui.Root.Get<BackgroundWidget>("SETTINGS_MENU");
|
||||
var tabs = bg.Get<ContainerWidget>("TAB_CONTAINER");
|
||||
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
pixelDoubleCheckbox.OnClick = () =>
|
||||
{
|
||||
gs.PixelDouble ^= true;
|
||||
Game.Zoom = gs.PixelDouble ? 2 : 1;
|
||||
worldRenderer.Viewport.Zoom = gs.PixelDouble ? 2 : 1;
|
||||
};
|
||||
|
||||
var capFrameRateCheckbox = display.Get<CheckboxWidget>("CAPFRAMERATE_CHECKBOX");
|
||||
|
||||
Reference in New Issue
Block a user