Game uses new format. Missing bridges/resources/smudges. Buggy map bounds, actor placement and tile images.

This commit is contained in:
Paul Chote
2010-04-01 19:13:26 +13:00
committed by Bob
parent 382efbcdfb
commit f7e2f414c0
20 changed files with 187 additions and 101 deletions

View File

@@ -36,8 +36,10 @@ namespace OpenRA.Traits
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;
List<Dictionary<int2, Sprite>> TileSprites = new List<Dictionary<int2,Sprite>>();
List<TileTemplate> Templates = new List<TileTemplate>();
@@ -47,7 +49,7 @@ namespace OpenRA.Traits
Bridge northNeighbour, southNeighbour;
public Bridge(Actor self) { this.self = self; self.RemoveOnDeath = false; }
static string cachedTheater;
static Cache<TileReference, Sprite> sprites;
@@ -169,5 +171,6 @@ namespace OpenRA.Traits
if (southNeighbour != null) southNeighbour.UpdateState();
}
}
*/
}
}

View File

@@ -58,6 +58,7 @@ namespace OpenRA.Traits
void DoBib(Actor self, bool isRemove)
{
/*
var buildingInfo = self.Info.Traits.Get<BuildingInfo>();
if (buildingInfo.Bib)
{
@@ -77,6 +78,7 @@ namespace OpenRA.Traits
self.World.Map.MapTiles[p.X, p.Y].smudge = (byte)(i + startIndex);
}
}
*/
}
protected string GetPrefix(Actor self)

View File

@@ -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.
* This file is part of OpenRA.
@@ -25,9 +25,9 @@ namespace OpenRA.Traits
{
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 minj = w.Map.YOffset; var maxj = w.Map.YOffset + w.Map.Height;
@@ -40,7 +40,7 @@ namespace OpenRA.Traits
foreach (var br in w.Actors.SelectMany(a => a.traits.WithInterface<Bridge>()))
br.FinalizeBridges(w);
}
static void ConvertBridgeToActor(World w, int i, int j)
{
var tile = w.Map.MapTiles[i, j].tile;
@@ -84,5 +84,6 @@ namespace OpenRA.Traits
}
public void WorldLoaded(World w) { MakeBridges(w); }
*/
}
}

View File

@@ -29,8 +29,16 @@ namespace OpenRA.Traits
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;
World w;
@@ -41,7 +49,7 @@ namespace OpenRA.Traits
{
sr = new SpriteRenderer( Game.renderer, true );
}
public void Render()
{
var shroud = Game.world.LocalPlayer.Shroud;
@@ -87,7 +95,7 @@ namespace OpenRA.Traits
if (content[x, y].type != null)
content[x, y].density = GetIdealDensity(x, y);
}
public Sprite[] ChooseContent(ResourceTypeInfo info)
{
return info.Sprites[w.SharedRandom.Next(info.Sprites.Length)];
@@ -187,6 +195,7 @@ namespace OpenRA.Traits
content[i, j].image = ChooseContent(info);
content[i, j].density = 0;
}
}
public ResourceTypeInfo GetResource(int2 p) { return content[p.X, p.Y].type; }
@@ -197,5 +206,6 @@ namespace OpenRA.Traits
public Sprite[] image;
public int density;
}
*/
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,10 +12,10 @@ namespace OpenRA.Traits
public void GameStarted(World world)
{
Game.skipMakeAnims = true; // rude hack
// TODO: Keep a dictionary of actor reference -> actor somewhere for scripting purposes
foreach (var actorReference in world.Map.Actors)
world.CreateActor(actorReference.Name, actorReference.Location,
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
world.CreateActor(actorReference.Value.Name, actorReference.Value.Location,
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Value.Owner)
?? world.NeutralPlayer);
Game.skipMakeAnims = false;

View File

@@ -13,11 +13,11 @@ namespace OpenRA.Traits
public object Create(Actor self) { return new WallLoadHook( self, this ); }
}
class WallLoadHook : IGameStarted
class WallLoadHook // : IGameStarted
{
WallLoadHookInfo info;
public WallLoadHook(Actor self, WallLoadHookInfo info) { this.info = info; }
/*
public void GameStarted(World w)
{
var map = w.Map;
@@ -27,5 +27,6 @@ namespace OpenRA.Traits
if (info.OverlayTypes.Contains(w.Map.MapTiles[x, y].overlay))
w.CreateActor(info.ActorType, new int2(x, y), w.NeutralPlayer);
}
*/
}
}