Skip to content

Commit 94ad47b

Browse files
Initial commit
1 parent 261f2f6 commit 94ad47b

File tree

14 files changed

+3034
-676
lines changed

14 files changed

+3034
-676
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/Tiled/bin
2+
/Tiled/obj
3+
*.suo
4+
/*.user
5+
packages/
6+
References/
7+
.vs/

LICENSE

Lines changed: 674 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1-
# Tiled
2-
Provides alternate tile implementations which improves memory usage and performance
1+
# Tiled plugin for TShock
2+
Provides alternate tile implementations which improve performance and memory usage
3+
4+
5+
Simply put Tiled.dll into your ServerPlugins folder. By default it will run the 1d tile provider, but you can use the **ONE** of the following command line arguments to switch to another provider:
6+
7+
```
8+
-tiled 1d # uses the 1d provider
9+
-tiled 2d # uses the 2d provider
10+
-tiled struct # uses the struct provider
11+
-tiled tsapi # uses tshocks default implementation
12+
```

Tiled.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiled", "Tiled\Tiled.csproj", "{3FE14D6D-B435-4D6B-A97D-2619496E4AD8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{3FE14D6D-B435-4D6B-A97D-2619496E4AD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3FE14D6D-B435-4D6B-A97D-2619496E4AD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3FE14D6D-B435-4D6B-A97D-2619496E4AD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3FE14D6D-B435-4D6B-A97D-2619496E4AD8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

Tiled/1d/1dTileProvider.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using OTAPI.Tile;
2+
using System;
3+
using Terraria;
4+
5+
namespace Tiled.OneDimension
6+
{
7+
public class OneDimensionTileProvider : ITileCollection, IDisposable
8+
{
9+
private StructTile[] data;
10+
private int _width;
11+
private int _height;
12+
13+
public int Width => this._width;
14+
public int Height => this._height;
15+
16+
public ITile this[int x, int y]
17+
{
18+
get
19+
{
20+
if (data == null)
21+
{
22+
data = new StructTile[(Main.maxTilesX + 1) * (Main.maxTilesY + 1)];
23+
24+
this._width = Main.maxTilesX + 1;
25+
this._height = Main.maxTilesY + 1;
26+
}
27+
28+
return new OneDimensionTileReference(data, (short)x, (short)y);
29+
}
30+
31+
set
32+
{
33+
(new OneDimensionTileReference(data, (short)x, (short)y)).CopyFrom(value);
34+
}
35+
}
36+
37+
public void Dispose()
38+
{
39+
if (data != null)
40+
{
41+
for (var x = 0; x < data.Length; x++)
42+
{
43+
data[x].bTileHeader = 0;
44+
data[x].bTileHeader2 = 0;
45+
data[x].bTileHeader3 = 0;
46+
data[x].frameX = 0;
47+
data[x].frameY = 0;
48+
data[x].liquid = 0;
49+
data[x].type = 0;
50+
data[x].wall = 0;
51+
}
52+
data = null;
53+
}
54+
}
55+
}
56+
57+
}

0 commit comments

Comments
 (0)