Add ability to disable the shellmap
This commit is contained in:
@@ -205,13 +205,13 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
public static event Action BeforeGameStart = () => {};
|
||||
internal static void StartGame(string mapUID)
|
||||
internal static void StartGame(string mapUID, bool isShellmap)
|
||||
{
|
||||
BeforeGameStart();
|
||||
|
||||
var map = modData.PrepareMap(mapUID);
|
||||
viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer);
|
||||
orderManager.world = new World(modData.Manifest, map, orderManager);
|
||||
orderManager.world = new World(modData.Manifest, map, orderManager) { IsShellmap = isShellmap };
|
||||
worldRenderer = new WorldRenderer(orderManager.world);
|
||||
|
||||
if (orderManager.GameStarted) return;
|
||||
@@ -306,7 +306,7 @@ namespace OpenRA
|
||||
|
||||
public static void LoadShellMap()
|
||||
{
|
||||
StartGame(ChooseShellmap());
|
||||
StartGame(ChooseShellmap(), true);
|
||||
}
|
||||
|
||||
static string ChooseShellmap()
|
||||
|
||||
1
OpenRA.Game/GameRules/Settings.cs
Executable file → Normal file
1
OpenRA.Game/GameRules/Settings.cs
Executable file → Normal file
@@ -90,6 +90,7 @@ namespace OpenRA.GameRules
|
||||
public string[] Mods = { "ra" };
|
||||
|
||||
public bool TeamChatToggle = false;
|
||||
public bool ShowShellmap = true;
|
||||
|
||||
public bool ViewportEdgeScroll = true;
|
||||
public MouseScrollType MouseScroll = MouseScrollType.Standard;
|
||||
|
||||
@@ -67,6 +67,10 @@ namespace OpenRA.Graphics
|
||||
public void Draw()
|
||||
{
|
||||
RefreshPalette();
|
||||
|
||||
if (world.IsShellmap && !Game.Settings.Game.ShowShellmap)
|
||||
return;
|
||||
|
||||
var bounds = Game.viewport.ViewBounds(world);
|
||||
Game.Renderer.EnableScissor(bounds.Left, bounds.Top, bounds.Width, bounds.Height);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Network
|
||||
case "StartGame":
|
||||
{
|
||||
Game.AddChatLine(Color.White, "Server", "The game has started.");
|
||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map);
|
||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,11 +151,18 @@ namespace OpenRA
|
||||
|
||||
// Will do bad things in multiplayer games
|
||||
public bool EnableTick = true;
|
||||
public bool IsShellmap = false;
|
||||
|
||||
bool ShouldTick()
|
||||
{
|
||||
if (!EnableTick) return false;
|
||||
return !IsShellmap || Game.Settings.Game.ShowShellmap;
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
// Todo: Expose this as an order so it can be synced
|
||||
if (EnableTick)
|
||||
if (ShouldTick())
|
||||
{
|
||||
using( new PerfSample("tick_idle") )
|
||||
foreach( var ni in ActorsWithTrait<INotifyIdle>() )
|
||||
@@ -171,7 +178,8 @@ namespace OpenRA
|
||||
x.Trait.Tick( x.Actor );
|
||||
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
||||
|
||||
effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
||||
effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)",
|
||||
Game.Settings.Debug.LongTickThreshold );
|
||||
}
|
||||
|
||||
while (frameEndActions.Count != 0)
|
||||
|
||||
@@ -65,6 +65,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
teamchatCheckbox.IsChecked = () => Game.Settings.Game.TeamChatToggle;
|
||||
teamchatCheckbox.OnClick = () => Game.Settings.Game.TeamChatToggle ^= true;
|
||||
|
||||
var showShellmapCheckbox = general.GetWidget<CheckboxWidget>("SHOW_SHELLMAP");
|
||||
showShellmapCheckbox.IsChecked = () => Game.Settings.Game.ShowShellmap;
|
||||
showShellmapCheckbox.OnClick = () => Game.Settings.Game.ShowShellmap ^= true;
|
||||
|
||||
// Audio
|
||||
var audio = bg.GetWidget("AUDIO_PANE");
|
||||
|
||||
|
||||
@@ -119,6 +119,13 @@ Background@SETTINGS_MENU:
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Shift-Enter Toggles Team Chat
|
||||
Checkbox@SHOW_SHELLMAP:
|
||||
Id:SHOW_SHELLMAP
|
||||
X:0
|
||||
Y:150
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Show Shellmap
|
||||
Container@AUDIO_PANE:
|
||||
Id:AUDIO_PANE
|
||||
X:37
|
||||
|
||||
Reference in New Issue
Block a user