mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-02 14:46:28 -05:00
Generate a very simple version of blood moore outside of camp.
This commit is contained in:
parent
7a1aea686b
commit
4021fc9793
@ -123,7 +123,7 @@ namespace OpenDiablo2.Core.GameState_
|
|||||||
LevelType = levelType,
|
LevelType = levelType,
|
||||||
FileData = fileData,
|
FileData = fileData,
|
||||||
CellInfo = new Dictionary<eRenderCellType, MapCellInfo[]>(),
|
CellInfo = new Dictionary<eRenderCellType, MapCellInfo[]>(),
|
||||||
TileLocation = new Rectangle(origin, new Size(fileData.Width, fileData.Height))
|
TileLocation = new Rectangle(origin, new Size(fileData.Width - 1, fileData.Height - 1))
|
||||||
};
|
};
|
||||||
|
|
||||||
mapInfo.Add(result);
|
mapInfo.Add(result);
|
||||||
@ -162,7 +162,7 @@ namespace OpenDiablo2.Core.GameState_
|
|||||||
LevelType = levelType,
|
LevelType = levelType,
|
||||||
FileData = fileData,
|
FileData = fileData,
|
||||||
CellInfo = new Dictionary<eRenderCellType, MapCellInfo[]>(),
|
CellInfo = new Dictionary<eRenderCellType, MapCellInfo[]>(),
|
||||||
TileLocation = new Rectangle(origin, new Size(fileData.Width, fileData.Height))
|
TileLocation = new Rectangle(origin, new Size(fileData.Width - 1, fileData.Height - 1))
|
||||||
};
|
};
|
||||||
|
|
||||||
mapInfo.Add(result);
|
mapInfo.Add(result);
|
||||||
@ -205,7 +205,8 @@ namespace OpenDiablo2.Core.GameState_
|
|||||||
{
|
{
|
||||||
var x = cellX;
|
var x = cellX;
|
||||||
var y = cellY;
|
var y = cellY;
|
||||||
var map = mapInfo.FirstOrDefault(z => z.TileLocation.Contains(x, y));
|
var map = mapInfo.FirstOrDefault(z => (x >= z.TileLocation.X) && (y >= z.TileLocation.Y)
|
||||||
|
&& (x < z.TileLocation.Right) && (y < z.TileLocation.Bottom));
|
||||||
if (map == null)
|
if (map == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -21,28 +21,52 @@ namespace OpenDiablo2.Core
|
|||||||
|
|
||||||
public void Generate()
|
public void Generate()
|
||||||
{
|
{
|
||||||
|
var random = new Random(gameState.Seed);
|
||||||
|
|
||||||
|
var test = gameState.LoadSubMap(2, new Point(10000, 10000));
|
||||||
var wildBorder = 5; // (4-15)
|
var wildBorder = 5; // (4-15)
|
||||||
// TODO: Is there no data file that explicitly defines this??
|
// TODO: Is there no data file that explicitly defines this??
|
||||||
var townMap = gameState.LoadMap(eLevelId.Act1_Town1, new Point(0, 0));
|
var townMap = gameState.LoadMap(eLevelId.Act1_Town1, new Point(0, 0));
|
||||||
|
Rectangle bloodMooreRect;
|
||||||
|
|
||||||
|
// 32-37 is grassy field?
|
||||||
|
|
||||||
if (townMap.FileData.MapFile.Contains("S1"))
|
if (townMap.FileData.MapFile.Contains("S1"))
|
||||||
{
|
{
|
||||||
var defId = 3; // Act 1 - Town 1 Transition S
|
var defId = 3; // Act 1 - Town 1 Transition S
|
||||||
var borderMap = gameState.LoadSubMap(defId, new Point(0, townMap.FileData.Height));
|
var borderMap = gameState.LoadSubMap(defId, new Point(0, townMap.FileData.Height - 2));
|
||||||
borderMap.PrimaryMap = townMap;
|
borderMap.PrimaryMap = townMap;
|
||||||
|
|
||||||
var wilderness = gameState.LoadSubMap(wildBorder, new Point(26, townMap.FileData.Height + borderMap.FileData.Height));
|
var wilderness = gameState.LoadSubMap(wildBorder, new Point(26, townMap.FileData.Height + borderMap.FileData.Height));
|
||||||
wilderness.PrimaryMap = townMap;
|
wilderness.PrimaryMap = townMap;
|
||||||
|
|
||||||
|
bloodMooreRect = new Rectangle(-40, townMap.FileData.Height + borderMap.FileData.Height, 120, 80);
|
||||||
}
|
}
|
||||||
else if (townMap.FileData.MapFile.Contains("E1"))
|
else if (townMap.FileData.MapFile.Contains("E1"))
|
||||||
{
|
{
|
||||||
var defId = 2; // Act 1 - Town 1 Transition E
|
var defId = 2; // Act 1 - Town 1 Transition E
|
||||||
var borderMap = gameState.LoadSubMap(defId, new Point(townMap.FileData.Width, 0));
|
var borderMap = gameState.LoadSubMap(defId, new Point(townMap.FileData.Width - 2, 0));
|
||||||
borderMap.PrimaryMap = townMap;
|
borderMap.PrimaryMap = townMap;
|
||||||
|
|
||||||
for (int i = 4; i <= 15; i++)
|
bloodMooreRect = new Rectangle(townMap.FileData.Width + borderMap.FileData.Width, -40, 80, 120);
|
||||||
|
}
|
||||||
|
else if (townMap.FileData.MapFile.Contains("W1"))
|
||||||
{
|
{
|
||||||
var wilderness = gameState.LoadSubMap(i, new Point(townMap.FileData.Width + borderMap.FileData.Width + ((i-4) * 10), 26));
|
bloodMooreRect = new Rectangle(-120, 0, 120, townMap.FileData.Height);
|
||||||
wilderness.PrimaryMap = townMap;
|
} else // North
|
||||||
|
{
|
||||||
|
bloodMooreRect = new Rectangle(0, -120, townMap.FileData.Width, 120);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the Blood Moore?
|
||||||
|
for (var y = 0; y < (bloodMooreRect.Height); y+= 8)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (var x = 0; x < (bloodMooreRect.Width); x += 8)
|
||||||
|
{
|
||||||
|
var tileIdx = 35;
|
||||||
|
var mapTile = gameState.LoadSubMap(tileIdx, new Point(bloodMooreRect.Left + x, bloodMooreRect.Top + y));
|
||||||
|
mapTile.PrimaryMap = townMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user