add a World type
This commit is contained in:
@@ -135,7 +135,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static event Action BeforeGameStart = () => { };
|
public static event Action BeforeGameStart = () => { };
|
||||||
internal static void StartGame(string mapUID, bool isShellmap)
|
internal static void StartGame(string mapUID, WorldType type)
|
||||||
{
|
{
|
||||||
Cursor.SetCursor(null);
|
Cursor.SetCursor(null);
|
||||||
BeforeGameStart();
|
BeforeGameStart();
|
||||||
@@ -146,14 +146,15 @@ namespace OpenRA
|
|||||||
map = ModData.PrepareMap(mapUID);
|
map = ModData.PrepareMap(mapUID);
|
||||||
using (new PerfTimer("NewWorld"))
|
using (new PerfTimer("NewWorld"))
|
||||||
{
|
{
|
||||||
OrderManager.World = new World(map, OrderManager, isShellmap);
|
OrderManager.World = new World(map, OrderManager, type);
|
||||||
OrderManager.World.Timestep = Timestep;
|
OrderManager.World.Timestep = Timestep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldRenderer != null)
|
if (worldRenderer != null)
|
||||||
worldRenderer.Dispose();
|
worldRenderer.Dispose();
|
||||||
|
|
||||||
worldRenderer = new WorldRenderer(OrderManager.World);
|
worldRenderer = new WorldRenderer(OrderManager.World);
|
||||||
|
|
||||||
using (new PerfTimer("LoadComplete"))
|
using (new PerfTimer("LoadComplete"))
|
||||||
OrderManager.World.LoadComplete(worldRenderer);
|
OrderManager.World.LoadComplete(worldRenderer);
|
||||||
|
|
||||||
@@ -375,7 +376,7 @@ namespace OpenRA
|
|||||||
var shellmap = ChooseShellmap();
|
var shellmap = ChooseShellmap();
|
||||||
|
|
||||||
using (new PerfTimer("StartGame"))
|
using (new PerfTimer("StartGame"))
|
||||||
StartGame(shellmap, true);
|
StartGame(shellmap, WorldType.Shellmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ChooseShellmap()
|
static string ChooseShellmap()
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
RefreshPalette();
|
RefreshPalette();
|
||||||
|
|
||||||
if (World.IsShellmap && !Game.Settings.Game.ShowShellmap)
|
if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var renderables = GenerateRenderables();
|
var renderables = GenerateRenderables();
|
||||||
@@ -156,7 +156,7 @@ namespace OpenRA.Graphics
|
|||||||
foreach (var r in g)
|
foreach (var r in g)
|
||||||
r.RenderDebugGeometry(this);
|
r.RenderDebugGeometry(this);
|
||||||
|
|
||||||
if (!World.IsShellmap && Game.Settings.Game.AlwaysShowStatusBars)
|
if (World.Type == WorldType.Regular && Game.Settings.Game.AlwaysShowStatusBars)
|
||||||
{
|
{
|
||||||
foreach (var g in World.Actors.Where(a => !a.Destroyed
|
foreach (var g in World.Actors.Where(a => !a.Destroyed
|
||||||
&& a.HasTrait<Selectable>()
|
&& a.HasTrait<Selectable>()
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
Game.AddChatLine(Color.White, "Server", "The game has started.");
|
Game.AddChatLine(Color.White, "Server", "The game has started.");
|
||||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, false);
|
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
|
public enum WorldType { Regular, Shellmap }
|
||||||
|
|
||||||
public class World
|
public class World
|
||||||
{
|
{
|
||||||
static readonly Func<int, int, bool> FalsePredicate = (u, v) => false;
|
static readonly Func<int, int, bool> FalsePredicate = (u, v) => false;
|
||||||
@@ -109,6 +111,8 @@ namespace OpenRA
|
|||||||
public readonly TileSet TileSet;
|
public readonly TileSet TileSet;
|
||||||
public readonly ActorMap ActorMap;
|
public readonly ActorMap ActorMap;
|
||||||
public readonly ScreenMap ScreenMap;
|
public readonly ScreenMap ScreenMap;
|
||||||
|
public readonly WorldType Type;
|
||||||
|
|
||||||
readonly GameInformation gameInfo;
|
readonly GameInformation gameInfo;
|
||||||
|
|
||||||
public void IssueOrder(Order o) { OrderManager.IssueOrder(o); } /* avoid exposing the OM to mod code */
|
public void IssueOrder(Order o) { OrderManager.IssueOrder(o); } /* avoid exposing the OM to mod code */
|
||||||
@@ -146,9 +150,9 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal World(Map map, OrderManager orderManager, bool isShellmap)
|
internal World(Map map, OrderManager orderManager, WorldType type)
|
||||||
{
|
{
|
||||||
IsShellmap = isShellmap;
|
Type = type;
|
||||||
OrderManager = orderManager;
|
OrderManager = orderManager;
|
||||||
orderGenerator = new UnitOrderGenerator();
|
orderGenerator = new UnitOrderGenerator();
|
||||||
Map = map;
|
Map = map;
|
||||||
@@ -242,7 +246,7 @@ namespace OpenRA
|
|||||||
public bool Paused { get; internal set; }
|
public bool Paused { get; internal set; }
|
||||||
public bool PredictedPaused { get; internal set; }
|
public bool PredictedPaused { get; internal set; }
|
||||||
public bool PauseStateLocked { get; set; }
|
public bool PauseStateLocked { get; set; }
|
||||||
public bool IsShellmap = false;
|
|
||||||
public int WorldTick { get; private set; }
|
public int WorldTick { get; private set; }
|
||||||
|
|
||||||
public void SetPauseState(bool paused)
|
public void SetPauseState(bool paused)
|
||||||
@@ -261,7 +265,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
|
if (!Paused && (Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap))
|
||||||
{
|
{
|
||||||
WorldTick++;
|
WorldTick++;
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
var installButton = widget.GetOrNull<ButtonWidget>("INSTALL_BUTTON");
|
var installButton = widget.GetOrNull<ButtonWidget>("INSTALL_BUTTON");
|
||||||
if (installButton != null)
|
if (installButton != null)
|
||||||
{
|
{
|
||||||
installButton.IsDisabled = () => world == null || !world.IsShellmap;
|
installButton.IsDisabled = () => world == null || world.Type != WorldType.Shellmap;
|
||||||
var args = new string[] { "Install.Music=true" };
|
var args = new string[] { "Install.Music=true" };
|
||||||
installButton.OnClick = () =>
|
installButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user