Skip to content

Commit 86f56aa

Browse files
committed
Change TSB generation to ensure that tile 0 is always reserved (because the game will seemingly render it as transparent no matter what)
1 parent 2e7ba0a commit 86f56aa

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

EPFExplorer/src/FileTypes/mpbfile.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ public class mpbfile
1919

2020
public void Load()
2121
{
22-
2322
//check for compression
2423

25-
2624
if (filebytes[0] == 0x11)
2725
{
2826
Console.WriteLine("we will guess at LZ11 compression");

EPFExplorer/src/FileTypes/tsbfile.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ public class tsbfile
1515

1616
public int number_of_tiles;
1717

18-
19-
2018
public void Load()
2119
{
22-
2320
palette = new Color[256]; //create palette and fill it with the colours from the tsb
2421

2522
for (int i = 0; i < 256; i++)

EPFExplorer/src/Forms/MPB_TSB_EditorForm.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public class Tile
3535

3636
public bool hasSimilarTile = false;
3737
public Tile SimilarTile; //the master tile that this one stores a reference to. (although this one can still have its own unique flipping etc)
38+
39+
public void fill8x8ImageWithAlphaColour() {
40+
for (int i = 0; i < 64; i++) {
41+
tileImage[i] = 0; //where 0 is always the index of the alpha colour
42+
}
43+
}
3844
}
3945

4046
public Dictionary<string, int> MPBFilesAndWidthsInTiles = new Dictionary<string, int>()
@@ -419,9 +425,12 @@ private void importFromPNG_Click(object sender, EventArgs e)
419425

420426
int pos = 0;
421427

422-
423428
List<Tile> uniqueTiles = new List<Tile>();
424429

430+
Tile boilerplateAlphaTile = new Tile();
431+
boilerplateAlphaTile.fill8x8ImageWithAlphaColour();
432+
uniqueTiles.Add(boilerplateAlphaTile);
433+
425434
for (int y = 0; y < height_in_tiles; y++)
426435
{
427436
for (int x = 0; x < width_in_tiles; x++)
@@ -487,7 +496,6 @@ private void importFromPNG_Click(object sender, EventArgs e)
487496

488497
//now we should have a list of tiles, some of which are mirrors of each other if applicable
489498

490-
491499
activeTsb.filebytes = new byte[0x200 + (uniqueTiles.Count * 64)];
492500

493501
//now write palette to tsb

0 commit comments

Comments
 (0)