starwindz wrote:Thank you very much for your great tool, SpritesConversionTool!
I have two questions and request for your work.
1. Can I include your tool(including modified version) to the next version of Total Pack?
2. Could you please explain the detailed algorithm of following two functions? I would like to understand your code.
internal static Boolean buildTile(Object[] files, string path, string output, int width = -1, int height = -1, bool relativeNegative = true)
private static Boolean buildDoor(Object[] files, string path, string output, int width = -1, int crop = -1)
Thank you so much again.
Answering your questions:
1. Yes, the project is licensed under MIT
https://github.com/lvcabral/PoPSpritesC ... License.md
2. Both methods are similar, the buildDoor, is a little different to allow different cropping on some mods, here a quick overview of
buildTile:
Boolean buildTile(Object[] files, string path, string output, int width = -1, int height = -1, bool relativeNegative = true)
The main objective of this method is to assemble a tile based on the different subparts.
Quick explanation of the parameters
files: this parameter should be an array with 'n' objects with 5 values each.
Like this example: {tilesPath, @"floor panels\normal base.bmp", new int[2] {0, 76}, true, true}
- Index 0: path to the root of PR exported files
- Index 1: relative path to the tile subpart bitmap file
- Index 2: relative position (x,y) where this subpart will be painted
- Index 3: when 'true' indicates that the subpart should have the background made transparent
- Index 4: when 'true' the bitmap will use the palette from "level color variations.pal" extracted from Prince.DAT
path: the path where the png files should be saved
output the file name of the tile
width and height:
By the default sizes are: dungeon = 60x79 pixels, palace=64x79 pixels
If you pass the parameters you can set any size
relativeNegative: If 'true' the vertical position will be relative to the bottom of the tile (default option)
The Algorithm:
Create a bitmap object with the width and height
Loop for each object on the "files" array
- Depending on the parameters will use the external or internal palette for transparency
- Draw the subpart image on the relative position
Save the tile as a png image.