cnc map tib support
This commit is contained in:
@@ -86,6 +86,7 @@ namespace OpenRA.FileFormats
|
|||||||
else // CNC
|
else // CNC
|
||||||
{
|
{
|
||||||
UnpackCncTileData(FileSystem.Open(filename.Substring(0,filename.Length-4)+".bin"));
|
UnpackCncTileData(FileSystem.Open(filename.Substring(0,filename.Length-4)+".bin"));
|
||||||
|
ReadCncOverlay(file);
|
||||||
ReadCncTrees(file);
|
ReadCncTrees(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ namespace OpenRA.FileFormats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static string[] overlaySpriteNames =
|
static string[] raOverlayNames =
|
||||||
{
|
{
|
||||||
"sbag", "cycl", "brik", "fenc", "wood",
|
"sbag", "cycl", "brik", "fenc", "wood",
|
||||||
"gold01", "gold02", "gold03", "gold04",
|
"gold01", "gold02", "gold03", "gold04",
|
||||||
@@ -186,7 +187,7 @@ namespace OpenRA.FileFormats
|
|||||||
for( int j = 0 ; j < MapSize ; j++ )
|
for( int j = 0 ; j < MapSize ; j++ )
|
||||||
{
|
{
|
||||||
byte o = ReadByte( ms );
|
byte o = ReadByte( ms );
|
||||||
MapTiles[ j, i ].overlay = (o == 255) ? null : overlaySpriteNames[o];
|
MapTiles[ j, i ].overlay = (o == 255) ? null : raOverlayNames[o];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +216,24 @@ namespace OpenRA.FileFormats
|
|||||||
MapTiles[ j, i ].image = (byte)( i % 4 + ( j % 4 ) * 4 );
|
MapTiles[ j, i ].image = (byte)( i % 4 + ( j % 4 ) * 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReadCncOverlay( IniFile file )
|
||||||
|
{
|
||||||
|
IniSection overlay = file.GetSection( "OVERLAY", true );
|
||||||
|
if( overlay == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach( KeyValuePair<string, string> kv in overlay )
|
||||||
|
{
|
||||||
|
var loc = int.Parse( kv.Key );
|
||||||
|
int2 cell = new int2(loc % MapSize, loc / MapSize);
|
||||||
|
|
||||||
|
Log.Write("Overlay {0} at ({1},{2})",kv.Value,cell.X,cell.Y);
|
||||||
|
MapTiles[ cell.X, cell.Y ].overlay = kv.Value.ToLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ReadCncTrees( IniFile file )
|
void ReadCncTrees( IniFile file )
|
||||||
{
|
{
|
||||||
IniSection terrain = file.GetSection( "TERRAIN", true );
|
IniSection terrain = file.GetSection( "TERRAIN", true );
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ namespace OpenRA
|
|||||||
Sprite[] shadowBits = SpriteSheetBuilder.LoadAllSprites("shadow");
|
Sprite[] shadowBits = SpriteSheetBuilder.LoadAllSprites("shadow");
|
||||||
Sprite[,] sprites = new Sprite[128, 128];
|
Sprite[,] sprites = new Sprite[128, 128];
|
||||||
bool dirty = true;
|
bool dirty = true;
|
||||||
|
bool hasGPS = false;
|
||||||
// TODO: Testing
|
|
||||||
bool hasGPS = true;
|
|
||||||
Player owner;
|
Player owner;
|
||||||
Map map;
|
Map map;
|
||||||
public Rectangle? bounds;
|
public Rectangle? bounds;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
|||||||
World w;
|
World w;
|
||||||
|
|
||||||
public ResourceTypeInfo[] resourceTypes;
|
public ResourceTypeInfo[] resourceTypes;
|
||||||
CellContents[,] content = new CellContents[128, 128];
|
CellContents[,] content;
|
||||||
|
|
||||||
public ResourceLayer(Actor self)
|
public ResourceLayer(Actor self)
|
||||||
{
|
{
|
||||||
@@ -65,6 +65,8 @@ namespace OpenRA.Traits
|
|||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
{
|
{
|
||||||
this.w = w;
|
this.w = w;
|
||||||
|
content = new CellContents[w.Map.MapSize, w.Map.MapSize];
|
||||||
|
|
||||||
resourceTypes = w.WorldActor.Info.Traits.WithInterface<ResourceTypeInfo>().ToArray();
|
resourceTypes = w.WorldActor.Info.Traits.WithInterface<ResourceTypeInfo>().ToArray();
|
||||||
foreach (var rt in resourceTypes)
|
foreach (var rt in resourceTypes)
|
||||||
rt.Sprites = rt.SpriteNames.Select(a => SpriteSheetBuilder.LoadAllSprites(a)).ToArray();
|
rt.Sprites = rt.SpriteNames.Select(a => SpriteSheetBuilder.LoadAllSprites(a)).ToArray();
|
||||||
|
|||||||
@@ -177,12 +177,31 @@ World:
|
|||||||
Race: nod
|
Race: nod
|
||||||
SellButton:
|
SellButton:
|
||||||
RepairButton:
|
RepairButton:
|
||||||
|
ChoosePaletteOnSelect:
|
||||||
|
WallLoadHook@sbag:
|
||||||
|
ActorType: sbag
|
||||||
|
OverlayTypes: sbag
|
||||||
|
WallLoadHook@cycl:
|
||||||
|
ActorType: cycl
|
||||||
|
OverlayTypes: cycl
|
||||||
|
WallLoadHook@brik:
|
||||||
|
ActorType: brik
|
||||||
|
OverlayTypes: brik
|
||||||
|
WallLoadHook@fenc:
|
||||||
|
ActorType: fenc
|
||||||
|
OverlayTypes: fenc
|
||||||
|
WallLoadHook@wood:
|
||||||
|
ActorType: wood
|
||||||
|
OverlayTypes: wood
|
||||||
|
WallLoadHook@barb:
|
||||||
|
ActorType: barb
|
||||||
|
OverlayTypes: barb
|
||||||
ResourceLayer:
|
ResourceLayer:
|
||||||
ResourceType@green-tib:
|
ResourceType@green-tib:
|
||||||
Overlays: 5,6,7,8,9,10,11,12
|
Overlays: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
||||||
Palette: player
|
Palette: player
|
||||||
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
||||||
ValuePerUnit: 30
|
ValuePerUnit: 30
|
||||||
Name: Tiberium
|
Name: Tiberium
|
||||||
GrowthInterval: .1
|
GrowthInterval: 1
|
||||||
SpreadInterval: .1
|
SpreadInterval: 6
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ SPLIT2:
|
|||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: terrain
|
||||||
SeedsOre:
|
SeedsResource:
|
||||||
|
ResourceType:Tiberium
|
||||||
-Selectable:
|
-Selectable:
|
||||||
SPLIT3:
|
SPLIT3:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: terrain
|
||||||
SeedsOre:
|
SeedsResource:
|
||||||
|
ResourceType:Tiberium
|
||||||
-Selectable:
|
-Selectable:
|
||||||
ROCK1:
|
ROCK1:
|
||||||
Inherits: ^Tree
|
Inherits: ^Tree
|
||||||
|
|||||||
Reference in New Issue
Block a user