Game uses new format. Missing bridges/resources/smudges. Buggy map bounds, actor placement and tile images.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace MapConverter
|
|||||||
|
|
||||||
public readonly int Width;
|
public readonly int Width;
|
||||||
public readonly int Height;
|
public readonly int Height;
|
||||||
public NewMap Map = new NewMap();
|
public Map Map = new Map();
|
||||||
|
|
||||||
static string Truncate( string s, int maxLength )
|
static string Truncate( string s, int maxLength )
|
||||||
{
|
{
|
||||||
@@ -183,10 +183,10 @@ namespace MapConverter
|
|||||||
|
|
||||||
void UnpackRATileData( MemoryStream ms )
|
void UnpackRATileData( MemoryStream ms )
|
||||||
{
|
{
|
||||||
Map.MapTiles = new NewTileReference<ushort, byte>[ MapSize, MapSize ];
|
Map.MapTiles = new TileReference<ushort, byte>[ MapSize, MapSize ];
|
||||||
for( int i = 0 ; i < MapSize ; i++ )
|
for( int i = 0 ; i < MapSize ; i++ )
|
||||||
for( int j = 0 ; j < MapSize ; j++ )
|
for( int j = 0 ; j < MapSize ; j++ )
|
||||||
Map.MapTiles[j, i] = new NewTileReference<ushort,byte>();
|
Map.MapTiles[j, i] = new TileReference<ushort,byte>();
|
||||||
|
|
||||||
for( int i = 0 ; i < MapSize ; i++ )
|
for( int i = 0 ; i < MapSize ; i++ )
|
||||||
for( int j = 0 ; j < MapSize ; j++ )
|
for( int j = 0 ; j < MapSize ; j++ )
|
||||||
@@ -203,7 +203,7 @@ namespace MapConverter
|
|||||||
|
|
||||||
void UnpackRAOverlayData( MemoryStream ms )
|
void UnpackRAOverlayData( MemoryStream ms )
|
||||||
{
|
{
|
||||||
Map.MapResources = new NewTileReference<byte, byte>[ MapSize, MapSize ];
|
Map.MapResources = new TileReference<byte, byte>[ MapSize, MapSize ];
|
||||||
for( int i = 0 ; i < MapSize ; i++ )
|
for( int i = 0 ; i < MapSize ; i++ )
|
||||||
for( int j = 0 ; j < MapSize ; j++ )
|
for( int j = 0 ; j < MapSize ; j++ )
|
||||||
{
|
{
|
||||||
@@ -213,7 +213,7 @@ namespace MapConverter
|
|||||||
if (o != 255 && resourceMapping.ContainsKey(raOverlayNames[o]))
|
if (o != 255 && resourceMapping.ContainsKey(raOverlayNames[o]))
|
||||||
res = resourceMapping[raOverlayNames[o]];
|
res = resourceMapping[raOverlayNames[o]];
|
||||||
|
|
||||||
Map.MapResources[j, i] = new NewTileReference<byte,byte>(res.First, res.Second);
|
Map.MapResources[j, i] = new TileReference<byte,byte>(res.First, res.Second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
public class Map
|
public class OldMap
|
||||||
{
|
{
|
||||||
public readonly string Title;
|
public readonly string Title;
|
||||||
public readonly string Theater;
|
public readonly string Theater;
|
||||||
@@ -41,7 +41,7 @@ namespace OpenRA.FileFormats
|
|||||||
public readonly int Height;
|
public readonly int Height;
|
||||||
public int2 Size { get { return new int2(Width, Height); } }
|
public int2 Size { get { return new int2(Width, Height); } }
|
||||||
|
|
||||||
public readonly TileReference[ , ] MapTiles;
|
public readonly OldTileReference[ , ] MapTiles;
|
||||||
public readonly List<ActorReference> Actors = new List<ActorReference>();
|
public readonly List<ActorReference> Actors = new List<ActorReference>();
|
||||||
|
|
||||||
public readonly IEnumerable<int2> SpawnPoints;
|
public readonly IEnumerable<int2> SpawnPoints;
|
||||||
@@ -51,7 +51,7 @@ namespace OpenRA.FileFormats
|
|||||||
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
|
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map(string filename)
|
public OldMap(string filename)
|
||||||
{
|
{
|
||||||
IniFile file = new IniFile(FileSystem.Open(filename));
|
IniFile file = new IniFile(FileSystem.Open(filename));
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ namespace OpenRA.FileFormats
|
|||||||
Height = int.Parse(map.GetValue("Height", "0"));
|
Height = int.Parse(map.GetValue("Height", "0"));
|
||||||
MapSize = (INIFormat == 3) ? 128 : 64;
|
MapSize = (INIFormat == 3) ? 128 : 64;
|
||||||
|
|
||||||
MapTiles = new TileReference[ MapSize, MapSize ];
|
MapTiles = new OldTileReference[ MapSize, MapSize ];
|
||||||
for (int j = 0; j < MapSize; j++)
|
for (int j = 0; j < MapSize; j++)
|
||||||
for (int i = 0; i < MapSize; i++)
|
for (int i = 0; i < MapSize; i++)
|
||||||
MapTiles[i, j] = new TileReference();
|
MapTiles[i, j] = new OldTileReference();
|
||||||
|
|
||||||
|
|
||||||
if (INIFormat == 3) // RA map
|
if (INIFormat == 3) // RA map
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
public class NewMap
|
public class Map
|
||||||
{
|
{
|
||||||
// Yaml map data
|
// Yaml map data
|
||||||
public int MapFormat = 1;
|
public int MapFormat = 1;
|
||||||
@@ -47,17 +47,30 @@ namespace OpenRA.FileFormats
|
|||||||
public string Tiledata;
|
public string Tiledata;
|
||||||
public byte TileFormat = 1;
|
public byte TileFormat = 1;
|
||||||
public int2 Size;
|
public int2 Size;
|
||||||
public NewTileReference<ushort,byte>[ , ] MapTiles;
|
public TileReference<ushort,byte>[ , ] MapTiles;
|
||||||
public NewTileReference<byte, byte>[ , ] MapResources;
|
public TileReference<byte, byte>[ , ] MapResources;
|
||||||
|
|
||||||
|
|
||||||
|
// Temporary compat hacks
|
||||||
|
public int MapSize {get {return Size.X;}}
|
||||||
|
public int XOffset {get {return Bounds[0];}}
|
||||||
|
public int YOffset {get {return Bounds[1];}}
|
||||||
|
public int2 Offset { get { return new int2( Bounds[0], Bounds[1] ); } }
|
||||||
|
public int Width {get {return Bounds[2];}}
|
||||||
|
public int Height {get {return Bounds[3];}}
|
||||||
|
public string Theater {get {return Tileset;}}
|
||||||
|
public IEnumerable<int2> SpawnPoints {get {return Waypoints.Select(kv => kv.Value);}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<string> SimpleFields = new List<string>() {
|
List<string> SimpleFields = new List<string>() {
|
||||||
"MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "Tiledata", "Preview", "Size", "Bounds"
|
"MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "Tiledata", "Preview", "Size", "Bounds"
|
||||||
};
|
};
|
||||||
|
|
||||||
public NewMap() {}
|
public Map() {}
|
||||||
|
|
||||||
public NewMap(string filename)
|
public Map(string filename)
|
||||||
{
|
{
|
||||||
var yaml = MiniYaml.FromFile(filename);
|
var yaml = MiniYaml.FromFile(filename);
|
||||||
|
|
||||||
@@ -140,18 +153,23 @@ namespace OpenRA.FileFormats
|
|||||||
Size.X = ReadWord(dataStream);
|
Size.X = ReadWord(dataStream);
|
||||||
Size.Y = ReadWord(dataStream);
|
Size.Y = ReadWord(dataStream);
|
||||||
|
|
||||||
MapTiles = new NewTileReference<ushort, byte>[ Size.X, Size.Y ];
|
MapTiles = new TileReference<ushort, byte>[ Size.X, Size.Y ];
|
||||||
MapResources = new NewTileReference<byte, byte>[ Size.X, Size.Y ];
|
MapResources = new TileReference<byte, byte>[ Size.X, Size.Y ];
|
||||||
|
|
||||||
// Load tile data
|
// Load tile data
|
||||||
for( int i = 0 ; i < Size.X ; i++ )
|
for( int i = 0 ; i < Size.X ; i++ )
|
||||||
for( int j = 0 ; j < Size.Y ; j++ )
|
for( int j = 0 ; j < Size.Y ; j++ )
|
||||||
MapTiles[i, j] = new NewTileReference<ushort,byte>(ReadWord(dataStream),ReadByte(dataStream));
|
{
|
||||||
|
ushort tile = ReadWord(dataStream);
|
||||||
|
byte index = ReadByte(dataStream);
|
||||||
|
byte image = (index == byte.MaxValue) ? (byte)( i % 4 + ( j % 4 ) * 4 ) : index;
|
||||||
|
MapTiles[i, j] = new TileReference<ushort,byte>(tile,index, image);
|
||||||
|
}
|
||||||
|
|
||||||
// Load resource data
|
// Load resource data
|
||||||
for( int i = 0 ; i < Size.X ; i++ )
|
for( int i = 0 ; i < Size.X ; i++ )
|
||||||
for( int j = 0 ; j < Size.Y ; j++ )
|
for( int j = 0 ; j < Size.Y ; j++ )
|
||||||
MapResources[i, j] = new NewTileReference<byte,byte>(ReadByte(dataStream),ReadByte(dataStream));
|
MapResources[i, j] = new TileReference<byte,byte>(ReadByte(dataStream),ReadByte(dataStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveBinaryData(string filepath)
|
public void SaveBinaryData(string filepath)
|
||||||
@@ -186,6 +204,16 @@ namespace OpenRA.FileFormats
|
|||||||
File.Move(filepath+".tmp",filepath);
|
File.Move(filepath+".tmp",filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInMap(int2 xy)
|
||||||
|
{
|
||||||
|
return IsInMap(xy.X,xy.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInMap(int x, int y)
|
||||||
|
{
|
||||||
|
return (x >= Bounds[0] && y >= Bounds[1] && x < Bounds[0] + Bounds[2] && y < Bounds[1] + Bounds[3]);
|
||||||
|
}
|
||||||
|
|
||||||
public void DebugContents()
|
public void DebugContents()
|
||||||
{
|
{
|
||||||
foreach (var field in SimpleFields)
|
foreach (var field in SimpleFields)
|
||||||
|
|||||||
@@ -20,15 +20,24 @@
|
|||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
public struct NewTileReference<T, U>
|
public struct TileReference<T, U>
|
||||||
{
|
{
|
||||||
public T type;
|
public T type;
|
||||||
public U index;
|
public U index;
|
||||||
|
public U image;
|
||||||
|
|
||||||
public NewTileReference(T t, U i)
|
public TileReference(T t, U i)
|
||||||
{
|
{
|
||||||
type = t;
|
type = t;
|
||||||
index = i;
|
index = i;
|
||||||
|
image = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileReference(T t, U i, U im)
|
||||||
|
{
|
||||||
|
type = t;
|
||||||
|
index = i;
|
||||||
|
image = im;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() { return type.GetHashCode() ^ index.GetHashCode(); }
|
public override int GetHashCode() { return type.GetHashCode() ^ index.GetHashCode(); }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace OpenRA.FileFormats
|
namespace OpenRA.FileFormats
|
||||||
{
|
{
|
||||||
public struct TileReference
|
public struct OldTileReference
|
||||||
{
|
{
|
||||||
public ushort tile;
|
public ushort tile;
|
||||||
public byte image;
|
public byte image;
|
||||||
@@ -34,11 +34,11 @@ namespace OpenRA.FileFormats
|
|||||||
if( obj == null )
|
if( obj == null )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileReference r = (TileReference)obj;
|
OldTileReference r = (OldTileReference)obj;
|
||||||
return ( r.image == image && r.tile == tile );
|
return ( r.image == image && r.tile == tile );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==( TileReference a, TileReference b ) { return a.Equals( b ); }
|
public static bool operator ==( OldTileReference a, OldTileReference b ) { return a.Equals( b ); }
|
||||||
public static bool operator !=( TileReference a, TileReference b ) { return !a.Equals( b ); }
|
public static bool operator !=( OldTileReference a, OldTileReference b ) { return !a.Equals( b ); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,13 +85,19 @@ namespace OpenRA.FileFormats
|
|||||||
tileIdFile.Close();
|
tileIdFile.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetBytes(TileReference r)
|
public byte[] GetBytes(TileReference<ushort,byte> r)
|
||||||
{
|
{
|
||||||
Terrain tile;
|
Terrain tile;
|
||||||
|
Log.Write("Attempting to load tile {0} {1}",r.type,r.image);
|
||||||
if( tiles.TryGetValue( r.tile, out tile ) )
|
try {
|
||||||
|
if( tiles.TryGetValue( r.type, out tile ) )
|
||||||
return tile.TileBitmapBytes[ r.image ];
|
return tile.TileBitmapBytes[ r.image ];
|
||||||
|
}
|
||||||
|
catch (System.ArgumentOutOfRangeException)
|
||||||
|
{
|
||||||
|
tiles.TryGetValue( 0xfffe, out tile );
|
||||||
|
return tile.TileBitmapBytes[ 0 ];
|
||||||
|
}
|
||||||
byte[] missingTile = new byte[ 24 * 24 ];
|
byte[] missingTile = new byte[ 24 * 24 ];
|
||||||
for( int i = 0 ; i < missingTile.Length ; i++ )
|
for( int i = 0 ; i < missingTile.Length ; i++ )
|
||||||
missingTile[ i ] = 0x36;
|
missingTile[ i ] = 0x36;
|
||||||
@@ -99,13 +105,10 @@ namespace OpenRA.FileFormats
|
|||||||
return missingTile;
|
return missingTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerrainType GetTerrainType(TileReference r)
|
public TerrainType GetTerrainType(TileReference<ushort,byte> r)
|
||||||
{
|
{
|
||||||
if (r.tile == 0xff || r.tile == 0xffff)
|
|
||||||
r.image = 0;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return walk[r.tile].TerrainType[r.image];
|
return walk[r.type].TerrainType[r.image];
|
||||||
}
|
}
|
||||||
catch (KeyNotFoundException)
|
catch (KeyNotFoundException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
public class Global
|
public class Global
|
||||||
{
|
{
|
||||||
public string Map = "scm02ea.ini";
|
public string Map = "mods/ra/testmap.yaml";
|
||||||
public string[] Packages = {}; // filename:sha1 pairs.
|
public string[] Packages = {}; // filename:sha1 pairs.
|
||||||
public string[] Mods = { "ra" }; // mod names
|
public string[] Mods = { "ra" }; // mod names
|
||||||
public int OrderLatency = 3;
|
public int OrderLatency = 3;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
LoadModPackages(manifest);
|
LoadModPackages(manifest);
|
||||||
|
|
||||||
Rules.LoadRules(mapName, manifest);
|
Rules.LoadRules(manifest);
|
||||||
Timer.Time( "load rules: {0}" );
|
Timer.Time( "load rules: {0}" );
|
||||||
|
|
||||||
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA
|
|||||||
public static Dictionary<string, VoiceInfo> Voices;
|
public static Dictionary<string, VoiceInfo> Voices;
|
||||||
public static Dictionary<TerrainType, TerrainCost> TerrainTypes;
|
public static Dictionary<TerrainType, TerrainCost> TerrainTypes;
|
||||||
|
|
||||||
public static void LoadRules(string map, Manifest m)
|
public static void LoadRules(Manifest m)
|
||||||
{
|
{
|
||||||
Log.Write("Using rules files: ");
|
Log.Write("Using rules files: ");
|
||||||
foreach (var y in m.Rules)
|
foreach (var y in m.Rules)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace OpenRA.GameRules
|
|||||||
// External game settings
|
// External game settings
|
||||||
public readonly string NetworkHost = "";
|
public readonly string NetworkHost = "";
|
||||||
public readonly int NetworkPort = 0;
|
public readonly int NetworkPort = 0;
|
||||||
public readonly string Map = "scm02ea.ini";
|
public readonly string Map = "mods/ra/testmap.yaml";
|
||||||
public readonly int Player = 1;
|
public readonly int Player = 1;
|
||||||
public readonly string Replay = "";
|
public readonly string Replay = "";
|
||||||
public readonly string PlayerName = "";
|
public readonly string PlayerName = "";
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -46,6 +46,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
var shroud = Game.world.LocalPlayer.Shroud;
|
var shroud = Game.world.LocalPlayer.Shroud;
|
||||||
|
|
||||||
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
|
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
|
||||||
@@ -63,6 +64,7 @@ namespace OpenRA.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
spriteRenderer.Flush();
|
spriteRenderer.Flush();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
Size tileSize = new Size( Game.CellSize, Game.CellSize );
|
Size tileSize = new Size( Game.CellSize, Game.CellSize );
|
||||||
|
|
||||||
var tileMapping = new Cache<TileReference, Sprite>(
|
var tileMapping = new Cache<TileReference<ushort,byte>, Sprite>(
|
||||||
x => SheetBuilder.SharedInstance.Add(world.TileSet.GetBytes(x), tileSize));
|
x => SheetBuilder.SharedInstance.Add(world.TileSet.GetBytes(x), tileSize));
|
||||||
|
|
||||||
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -31,22 +31,25 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static void AddSmudge(this Map map, bool isCrater, int x, int y)
|
public static void AddSmudge(this Map map, bool isCrater, int x, int y)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
var smudge = map.MapTiles[x, y].smudge;
|
var smudge = map.MapTiles[x, y].smudge;
|
||||||
if (smudge == 0)
|
if (smudge == 0)
|
||||||
map.MapTiles[x, y].smudge = (byte) (isCrater
|
map.MapTiles[x, y].smudge = (byte) (isCrater
|
||||||
? (firstCrater + framesPerCrater * ChooseSmudge())
|
? (firstCrater + framesPerCrater * ChooseSmudge())
|
||||||
: (firstScorch + ChooseSmudge()));
|
: (firstScorch + ChooseSmudge()));
|
||||||
|
|
||||||
if (smudge < firstCrater || !isCrater) return; /* bib or scorch; don't change */
|
if (smudge < firstCrater || !isCrater) return; / * bib or scorch; don't change * /
|
||||||
|
|
||||||
/* deepen the crater */
|
/ * deepen the crater * /
|
||||||
var amount = (smudge - firstCrater) % framesPerCrater;
|
var amount = (smudge - firstCrater) % framesPerCrater;
|
||||||
if (amount < framesPerCrater - 1)
|
if (amount < framesPerCrater - 1)
|
||||||
map.MapTiles[x, y].smudge++;
|
map.MapTiles[x, y].smudge++;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddSmudge(this Map map, int2 targetTile, WarheadInfo warhead)
|
public static void AddSmudge(this Map map, int2 targetTile, WarheadInfo warhead)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (warhead.SmudgeType == SmudgeType.None) return;
|
if (warhead.SmudgeType == SmudgeType.None) return;
|
||||||
if (warhead.Size[0] == 0 && warhead.Size[1] == 0)
|
if (warhead.Size[0] == 0 && warhead.Size[1] == 0)
|
||||||
map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, targetTile.X, targetTile.Y);
|
map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, targetTile.X, targetTile.Y);
|
||||||
@@ -55,9 +58,10 @@ namespace OpenRA
|
|||||||
if ((t - targetTile).LengthSquared >= warhead.Size[1] * warhead.Size[1])
|
if ((t - targetTile).LengthSquared >= warhead.Size[1] * warhead.Size[1])
|
||||||
if (Rules.TerrainTypes[Game.world.GetTerrainType(t)].AcceptSmudge)
|
if (Rules.TerrainTypes[Game.world.GetTerrainType(t)].AcceptSmudge)
|
||||||
map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, t.X, t.Y);
|
map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, t.X, t.Y);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lastSmudge = 0;
|
static int lastSmudge = 0;
|
||||||
static int ChooseSmudge() { lastSmudge = (lastSmudge + 1) % 6; return lastSmudge; }
|
static int ChooseSmudge() { return 0; /*lastSmudge = (lastSmudge + 1) % 6; return lastSmudge; */}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,10 @@ namespace OpenRA.Traits
|
|||||||
public object Create(Actor self) { return new Bridge(self); }
|
public object Create(Actor self) { return new Bridge(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Bridge : IRender, ICustomTerrain, INotifyDamage
|
class Bridge // : IRender, ICustomTerrain, INotifyDamage
|
||||||
{
|
{
|
||||||
|
public Bridge(Actor self) { }
|
||||||
|
/*
|
||||||
Dictionary<int2, int> Tiles;
|
Dictionary<int2, int> Tiles;
|
||||||
List<Dictionary<int2, Sprite>> TileSprites = new List<Dictionary<int2,Sprite>>();
|
List<Dictionary<int2, Sprite>> TileSprites = new List<Dictionary<int2,Sprite>>();
|
||||||
List<TileTemplate> Templates = new List<TileTemplate>();
|
List<TileTemplate> Templates = new List<TileTemplate>();
|
||||||
@@ -169,5 +171,6 @@ namespace OpenRA.Traits
|
|||||||
if (southNeighbour != null) southNeighbour.UpdateState();
|
if (southNeighbour != null) southNeighbour.UpdateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
void DoBib(Actor self, bool isRemove)
|
void DoBib(Actor self, bool isRemove)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
var buildingInfo = self.Info.Traits.Get<BuildingInfo>();
|
var buildingInfo = self.Info.Traits.Get<BuildingInfo>();
|
||||||
if (buildingInfo.Bib)
|
if (buildingInfo.Bib)
|
||||||
{
|
{
|
||||||
@@ -77,6 +78,7 @@ namespace OpenRA.Traits
|
|||||||
self.World.Map.MapTiles[p.X, p.Y].smudge = (byte)(i + startIndex);
|
self.World.Map.MapTiles[p.X, p.Y].smudge = (byte)(i + startIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string GetPrefix(Actor self)
|
protected string GetPrefix(Actor self)
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -25,9 +25,9 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
class BridgeLoadHookInfo : StatelessTraitInfo<BridgeLoadHook> { }
|
class BridgeLoadHookInfo : StatelessTraitInfo<BridgeLoadHook> { }
|
||||||
|
|
||||||
class BridgeLoadHook : ILoadWorldHook
|
class BridgeLoadHook// : ILoadWorldHook
|
||||||
{
|
{
|
||||||
static void MakeBridges(World w)
|
/*static void MakeBridges(World w)
|
||||||
{
|
{
|
||||||
var mini = w.Map.XOffset; var maxi = w.Map.XOffset + w.Map.Width;
|
var mini = w.Map.XOffset; var maxi = w.Map.XOffset + w.Map.Width;
|
||||||
var minj = w.Map.YOffset; var maxj = w.Map.YOffset + w.Map.Height;
|
var minj = w.Map.YOffset; var maxj = w.Map.YOffset + w.Map.Height;
|
||||||
@@ -84,5 +84,6 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void WorldLoaded(World w) { MakeBridges(w); }
|
public void WorldLoaded(World w) { MakeBridges(w); }
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,16 @@ namespace OpenRA.Traits
|
|||||||
public object Create(Actor self) { return new ResourceLayer(self); }
|
public object Create(Actor self) { return new ResourceLayer(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResourceLayer : IRenderOverlay, ILoadWorldHook
|
class ResourceLayer// : IRenderOverlay, ILoadWorldHook
|
||||||
{
|
{
|
||||||
|
public ResourceLayer(Actor self) {}
|
||||||
|
public void Destroy(int2 p){}
|
||||||
|
public ResourceTypeInfo GetResource(int2 p) {return null;}
|
||||||
|
public ResourceTypeInfo Harvest(int2 p) {return null;}
|
||||||
|
public void AddResource(ResourceTypeInfo info, int i, int j, int n) {}
|
||||||
|
public void Grow(ResourceTypeInfo info) {}
|
||||||
|
public void Spread(ResourceTypeInfo info) {}
|
||||||
|
/*
|
||||||
SpriteRenderer sr;
|
SpriteRenderer sr;
|
||||||
World w;
|
World w;
|
||||||
|
|
||||||
@@ -187,6 +195,7 @@ namespace OpenRA.Traits
|
|||||||
content[i, j].image = ChooseContent(info);
|
content[i, j].image = ChooseContent(info);
|
||||||
content[i, j].density = 0;
|
content[i, j].density = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceTypeInfo GetResource(int2 p) { return content[p.X, p.Y].type; }
|
public ResourceTypeInfo GetResource(int2 p) { return content[p.X, p.Y].type; }
|
||||||
@@ -197,5 +206,6 @@ namespace OpenRA.Traits
|
|||||||
public Sprite[] image;
|
public Sprite[] image;
|
||||||
public int density;
|
public int density;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -12,10 +12,10 @@ namespace OpenRA.Traits
|
|||||||
public void GameStarted(World world)
|
public void GameStarted(World world)
|
||||||
{
|
{
|
||||||
Game.skipMakeAnims = true; // rude hack
|
Game.skipMakeAnims = true; // rude hack
|
||||||
|
// TODO: Keep a dictionary of actor reference -> actor somewhere for scripting purposes
|
||||||
foreach (var actorReference in world.Map.Actors)
|
foreach (var actorReference in world.Map.Actors)
|
||||||
world.CreateActor(actorReference.Name, actorReference.Location,
|
world.CreateActor(actorReference.Value.Name, actorReference.Value.Location,
|
||||||
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
|
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Value.Owner)
|
||||||
?? world.NeutralPlayer);
|
?? world.NeutralPlayer);
|
||||||
|
|
||||||
Game.skipMakeAnims = false;
|
Game.skipMakeAnims = false;
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ namespace OpenRA.Traits
|
|||||||
public object Create(Actor self) { return new WallLoadHook( self, this ); }
|
public object Create(Actor self) { return new WallLoadHook( self, this ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class WallLoadHook : IGameStarted
|
class WallLoadHook // : IGameStarted
|
||||||
{
|
{
|
||||||
WallLoadHookInfo info;
|
WallLoadHookInfo info;
|
||||||
public WallLoadHook(Actor self, WallLoadHookInfo info) { this.info = info; }
|
public WallLoadHook(Actor self, WallLoadHookInfo info) { this.info = info; }
|
||||||
|
/*
|
||||||
public void GameStarted(World w)
|
public void GameStarted(World w)
|
||||||
{
|
{
|
||||||
var map = w.Map;
|
var map = w.Map;
|
||||||
@@ -27,5 +27,6 @@ namespace OpenRA.Traits
|
|||||||
if (info.OverlayTypes.Contains(w.Map.MapTiles[x, y].overlay))
|
if (info.OverlayTypes.Contains(w.Map.MapTiles[x, y].overlay))
|
||||||
w.CreateActor(info.ActorType, new int2(x, y), w.NeutralPlayer);
|
w.CreateActor(info.ActorType, new int2(x, y), w.NeutralPlayer);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +1,68 @@
|
|||||||
MapFormat: 1
|
MapFormat: 1
|
||||||
Title: Scripted Multiplayer map
|
|
||||||
Description:
|
Title: Isle of Fury (6-8)
|
||||||
Author: Me
|
|
||||||
PlayerCount: 2
|
Author: Westwood Studios
|
||||||
|
|
||||||
|
PlayerCount: 8
|
||||||
|
|
||||||
Tileset: TEMPERAT
|
Tileset: TEMPERAT
|
||||||
Preview: testmap.png
|
|
||||||
Tiledata: testmap.bin
|
Tiledata: testmap.bin
|
||||||
|
|
||||||
Waypoints:
|
Size: 128,128
|
||||||
spawn0: 36,75
|
|
||||||
spawn1: 92,29
|
|
||||||
|
|
||||||
Players:
|
Bounds: 14,17,96,96
|
||||||
neutral:
|
|
||||||
Color:Gray
|
|
||||||
Type:Scripted
|
|
||||||
NoSpawn:true
|
|
||||||
ai:
|
|
||||||
Type:BrutalAI
|
|
||||||
Color:Red
|
|
||||||
Country:Russia
|
|
||||||
# AI player starts with a pre-placed base
|
|
||||||
NoSpawn:true
|
|
||||||
player0:
|
|
||||||
player1:
|
|
||||||
|
|
||||||
Actors:
|
Actors:
|
||||||
tree0: TC05 neutral 93,90
|
Actor0: TC05 Neutral 93,90
|
||||||
tree1: TC04 neutral 92,92
|
Actor1: TC04 Neutral 92,92
|
||||||
tree2: TC01 neutral 88,92
|
Actor2: TC01 Neutral 88,92
|
||||||
tree3: T11 neutral 96,93
|
Actor3: T11 Neutral 96,93
|
||||||
tree4: T08 neutral 90,94
|
Actor4: T08 Neutral 90,94
|
||||||
mine0: MINE neutral 67,103
|
Actor5: MINE Neutral 67,103
|
||||||
|
Actor6: MINE Neutral 52,97
|
||||||
|
Actor7: MINE Neutral 48,81
|
||||||
|
Actor8: TC05 Neutral 59,103
|
||||||
|
Actor9: TC01 Neutral 52,102
|
||||||
|
Actor10: T08 Neutral 71,97
|
||||||
|
Actor11: T08 Neutral 50,94
|
||||||
|
Actor12: MINE Neutral 47,78
|
||||||
|
Actor13: T14 Neutral 41,52
|
||||||
|
Actor14: MINE Neutral 37,44
|
||||||
|
Actor15: MINE Neutral 27,52
|
||||||
|
Actor16: MINE Neutral 64,79
|
||||||
|
Actor17: MINE Neutral 64,62
|
||||||
|
Actor18: MINE Neutral 61,24
|
||||||
|
Actor19: MINE Neutral 68,27
|
||||||
|
Actor20: MINE Neutral 61,35
|
||||||
|
Actor21: MINE Neutral 89,50
|
||||||
|
Actor22: MINE Neutral 67,98
|
||||||
|
Actor23: TC04 Neutral 53,73
|
||||||
|
Actor24: TC03 Neutral 81,65
|
||||||
|
Actor25: TC04 Neutral 97,41
|
||||||
|
Actor26: TC05 Neutral 67,49
|
||||||
|
Actor27: TC02 Neutral 53,59
|
||||||
|
Actor28: TC03 Neutral 22,51
|
||||||
|
Actor29: TC01 Neutral 25,53
|
||||||
|
Actor30: TC01 Neutral 47,22
|
||||||
|
Actor31: TC02 Neutral 32,36
|
||||||
|
Actor32: TC02 Neutral 25,77
|
||||||
|
Actor33: TC04 Neutral 28,81
|
||||||
|
Actor34: TC02 Neutral 29,87
|
||||||
|
Actor35: T08 Neutral 25,81
|
||||||
|
Actor36: T08 Neutral 52,59
|
||||||
|
Actor37: T08 Neutral 51,57
|
||||||
|
|
||||||
# <A bunch of pre-placed stuff to give ai player an advantage>
|
Waypoints:
|
||||||
pwn01: 4tnk ai 1,1
|
spawn0: 87,100
|
||||||
pwn02: 4tnk ai 1,2
|
spawn1: 36,75
|
||||||
pwn03: 4tnk ai 1,3
|
spawn2: 92,29
|
||||||
# ...
|
spawn3: 31,30
|
||||||
|
spawn4: 61,54
|
||||||
|
spawn5: 91,63
|
||||||
|
spawn6: 34,97
|
||||||
|
spawn7: 63,83
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
Player:
|
|
||||||
ChronoshiftPower:
|
|
||||||
ChargeTime:1
|
|
||||||
|
|||||||
Reference in New Issue
Block a user