Theater definitions in yaml
This commit is contained in:
@@ -51,8 +51,6 @@ namespace OpenRA.FileFormats
|
||||
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
|
||||
}
|
||||
|
||||
public string TileSuffix { get { return "." + Truncate(Theater, 3); } }
|
||||
|
||||
public Map(string filename)
|
||||
{
|
||||
IniFile file = new IniFile(FileSystem.Open(filename));
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
public readonly Dictionary<ushort, Terrain> tiles = new Dictionary<ushort, Terrain>();
|
||||
|
||||
public readonly Walkability Walkability = new Walkability();
|
||||
public readonly Walkability Walkability;
|
||||
public readonly Dictionary<ushort, TileTemplate> walk
|
||||
= new Dictionary<ushort, TileTemplate>();
|
||||
|
||||
@@ -46,12 +46,12 @@ namespace OpenRA.FileFormats
|
||||
return ret;
|
||||
}
|
||||
|
||||
public TileSet( string suffix )
|
||||
public TileSet( string tilesetFile, string templatesFile, string suffix )
|
||||
{
|
||||
Walkability = new Walkability();
|
||||
Walkability = new Walkability(templatesFile);
|
||||
|
||||
char tileSetChar = char.ToUpperInvariant( suffix[ 1 ] );
|
||||
StreamReader tileIdFile = new StreamReader( FileSystem.Open( "tileSet.til" ) );
|
||||
char tileSetChar = char.ToUpperInvariant( suffix[ 0 ] );
|
||||
StreamReader tileIdFile = new StreamReader( FileSystem.Open(tilesetFile) );
|
||||
|
||||
while( true )
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
|
||||
if (!walk.ContainsKey((ushort)(start + i)))
|
||||
walk.Add((ushort)(start + i), Walkability.GetWalkability(tilename));
|
||||
|
||||
using( Stream s = FileSystem.Open( tilename + suffix ) )
|
||||
using( Stream s = FileSystem.Open( tilename + "." + suffix ) )
|
||||
{
|
||||
if( !tiles.ContainsKey( (ushort)( start + i ) ) )
|
||||
tiles.Add( (ushort)( start + i ), new Terrain( s ) );
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace OpenRA.FileFormats
|
||||
Dictionary<string, TileTemplate> walkability
|
||||
= new Dictionary<string,TileTemplate>();
|
||||
|
||||
public Walkability()
|
||||
public Walkability(string templatesFile)
|
||||
{
|
||||
var file = new IniFile( FileSystem.Open( "templates.ini" ) );
|
||||
var file = new IniFile( FileSystem.Open( templatesFile ) );
|
||||
|
||||
foreach (var section in file.Sections)
|
||||
{
|
||||
|
||||
@@ -339,7 +339,9 @@ namespace OpenRA
|
||||
DrawCentered("Size: {0}x{1}".F(currentMap.Map.Width, currentMap.Map.Height),
|
||||
new int2(mapRect.Left + mapRect.Width / 2, y), Color.White);
|
||||
y += 20;
|
||||
DrawCentered("Theater: {0}".F(currentMap.Map.Theater, currentMap.Map.Height),
|
||||
|
||||
TheaterInfo theaterInfo = Game.world.WorldActor.Info.Traits.WithInterface<TheaterInfo>().Where(t => t.Theater == currentMap.Map.Theater).FirstOrDefault();
|
||||
DrawCentered("Theater: {0}".F(theaterInfo.Name, currentMap.Map.Height),
|
||||
new int2(mapRect.Left + mapRect.Width / 2, y), Color.White);
|
||||
y += 20;
|
||||
DrawCentered("Spawnpoints: {0}".F(currentMap.Map.SpawnPoints.Count()),
|
||||
|
||||
@@ -269,6 +269,7 @@
|
||||
<Compile Include="Traits\Player\EvaAlerts.cs" />
|
||||
<Compile Include="Traits\World\ScreenShaker.cs" />
|
||||
<Compile Include="Traits\LineBuild.cs" />
|
||||
<Compile Include="Traits\World\Theater.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
32
OpenRA.Game/Traits/World/Theater.cs
Normal file
32
OpenRA.Game/Traits/World/Theater.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
*
|
||||
* OpenRA is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OpenRA is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class TheaterInfo : StatelessTraitInfo<Theater>
|
||||
{
|
||||
public readonly string Name = null;
|
||||
public readonly string Theater = null;
|
||||
public readonly string Suffix = null;
|
||||
public readonly string Tileset = null;
|
||||
public readonly string Templates = null;
|
||||
}
|
||||
class Theater {}
|
||||
}
|
||||
@@ -59,8 +59,7 @@ namespace OpenRA
|
||||
Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName));
|
||||
}
|
||||
|
||||
public readonly Actor WorldActor;
|
||||
|
||||
public readonly Actor WorldActor;
|
||||
public readonly PathFinder PathFinder;
|
||||
|
||||
public readonly Map Map;
|
||||
@@ -75,9 +74,13 @@ namespace OpenRA
|
||||
public World()
|
||||
{
|
||||
Timer.Time( "----World.ctor" );
|
||||
|
||||
Map = new Map( Game.LobbyInfo.GlobalSettings.Map );
|
||||
Timer.Time( "new Map: {0}" );
|
||||
TileSet = new TileSet( Map.TileSuffix );
|
||||
|
||||
TheaterInfo theaterInfo = Rules.Info["world"].Traits.WithInterface<TheaterInfo>().Where(t => t.Theater == Map.Theater).FirstOrDefault();
|
||||
TileSet = new TileSet(theaterInfo.Tileset, theaterInfo.Templates, theaterInfo.Suffix);
|
||||
|
||||
SpriteSheetBuilder.Initialize( Map );
|
||||
Timer.Time( "Tileset: {0}" );
|
||||
|
||||
|
||||
@@ -205,3 +205,21 @@ World:
|
||||
Name: Tiberium
|
||||
GrowthInterval: 1
|
||||
SpreadInterval: 6
|
||||
Theater@DESERT:
|
||||
Name:Desert
|
||||
Theater:DESERT
|
||||
Suffix:des
|
||||
Templates:templates.ini
|
||||
Tileset:tileSet.til
|
||||
Theater@WINTER:
|
||||
Name:Winter
|
||||
Theater:WINTER
|
||||
Suffix:win
|
||||
Templates:templates.ini
|
||||
Tileset:tileSet.til
|
||||
Theater@TEMPERAT:
|
||||
Name:Temperate
|
||||
Theater:TEMPERAT
|
||||
Suffix:tem
|
||||
Templates:templates.ini
|
||||
Tileset:tileSet.til
|
||||
@@ -21,7 +21,7 @@ MCV:
|
||||
Offset:-1,-1
|
||||
DeployDirections: 96
|
||||
TransformSounds: constru2.aud, hvydoor1.aud
|
||||
NoTransformSounds: nodeply1.aud
|
||||
NoTransformSounds: deploy1.aud
|
||||
RenderUnit:
|
||||
|
||||
HARV:
|
||||
|
||||
@@ -244,7 +244,19 @@ World:
|
||||
SpriteNames: gem01,gem02,gem03,gem04
|
||||
ValuePerUnit: 50
|
||||
Name: Gems
|
||||
|
||||
Theater@SNOW:
|
||||
Name:Snow
|
||||
Theater:SNOW
|
||||
Suffix:sno
|
||||
Templates:templates.ini
|
||||
Tileset:tileSet.til
|
||||
Theater@TEMPERAT:
|
||||
Name:Temperate
|
||||
Theater:TEMPERAT
|
||||
Suffix:tem
|
||||
Templates:templates.ini
|
||||
Tileset:tileSet.til
|
||||
|
||||
MGG:
|
||||
GeneratesGap:
|
||||
Range: 10
|
||||
|
||||
Reference in New Issue
Block a user