added units.ini (and campaignUnits.ini), and IniFile got support for load/merging multiple files.
- Rules can now handle map-specific rules changes
- units.ini replaces {buildings,units,infantry}.txt (or will replace; sidebar still uses them)
- Added support for loading map-placed units/structures - try scg11eb.ini
- added FCOM
This commit is contained in:
@@ -34,12 +34,13 @@ namespace OpenRa.Game
|
||||
|
||||
public Game(string mapName, Renderer renderer, int2 clientSize)
|
||||
{
|
||||
Rules.LoadRules();
|
||||
Rules.LoadRules( mapName );
|
||||
|
||||
for( int i = 0 ; i < 8 ; i++ )
|
||||
players.Add(i, new Player(i, string.Format("Multi{0}", i), Race.Soviet));
|
||||
|
||||
map = new Map(new IniFile(FileSystem.Open(mapName)));
|
||||
var mapFile = new IniFile( FileSystem.Open( mapName ) );
|
||||
map = new Map( mapFile );
|
||||
FileSystem.Mount(new Package(map.Theater + ".mix"));
|
||||
|
||||
viewport = new Viewport(clientSize, map.Size, renderer);
|
||||
@@ -51,6 +52,9 @@ namespace OpenRa.Game
|
||||
foreach( TreeReference treeReference in map.Trees )
|
||||
world.Add( new Actor( treeReference, treeCache, map.Offset ) );
|
||||
|
||||
LoadMapBuildings( mapFile );
|
||||
LoadMapUnits( mapFile );
|
||||
|
||||
LocalPlayerBuildings = new BuildingInfluenceMap(world, LocalPlayer);
|
||||
|
||||
pathFinder = new PathFinder(map, terrain.tileSet, LocalPlayerBuildings);
|
||||
@@ -66,6 +70,28 @@ namespace OpenRa.Game
|
||||
PlaySound("intro.aud", false);
|
||||
}
|
||||
|
||||
void LoadMapBuildings( IniFile mapfile )
|
||||
{
|
||||
foreach( var s in mapfile.GetSection( "STRUCTURES", true ) )
|
||||
{
|
||||
//num=owner,type,health,location,facing,trigger,unknown,shouldRepair
|
||||
var parts = s.Value.ToLowerInvariant().Split( ',' );
|
||||
var loc = int.Parse( parts[ 3 ] );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128 - map.Offset.X, loc / 128-map.Offset.Y ), players[ 0 ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
void LoadMapUnits( IniFile mapfile )
|
||||
{
|
||||
foreach( var s in mapfile.GetSection( "UNITS", true ) )
|
||||
{
|
||||
//num=owner,type,health,location,facing,action,trigger
|
||||
var parts = s.Value.ToLowerInvariant().Split( ',' );
|
||||
var loc = int.Parse( parts[ 3 ] );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128 - map.Offset.X, loc / 128 - map.Offset.Y ), players[ 0 ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
readonly Cache<string, ISoundSource> sounds;
|
||||
|
||||
ISoundSource LoadSound(string filename)
|
||||
|
||||
Reference in New Issue
Block a user