Jump to content

Add a new door to the area (with tiles!)

Recommended Posts

I have updated the library with a new function, ps_tileset_replace_palette_entry, that replaces palette entries with a new color. So say there was a tileset with a tile that contained a pure green pixel, which would look odd. You can use this function to replace every pure green pixel with some other color. I feel like there was a fixpack somewhere that did something like this. A problem arises if you need to replace the color of a single pixel without entirely removing that color from the tile (like if that bad green pixel was in a door or water overlay tile that intentionally uses green for the transparent sections). To replace the color of this pixel, you would first look to see if the color you want to replace it with was already in the palette. If it is, great you're done. If it isn't, you would next have to look for an unused palette entry. If every palette entry is used, you would look for duplicate palette entries, combine them, and then use the free entry. If there are no duplicates, you're left with calculating the nearest-neighbor color within the existing color pool. I have basically already done this for BAMs in a different language (AHK) so I know how to do this, but rewriting it in WeiDU would constitute significant time and effort. While this last function would complete my initial vision for this tileset function library, I'm a bit hesitant to put forth the effort if there is no need for it. Other than this, my library (along with Tile2EE) includes the capability to do anything with a tileset I could envision anyone wanting to do that couldn't be done better with just a well placed WRITE_BYTE.


Thoughts? Anyone know which fixpack I vaguely remember or how it went about replacing green pixels?

Link to post


I broke down and wrote it anyway, which concludes my initial vision for the project. The first beta release containing the full feature set can be found on GitHub.

Wow thanks! Could you write a tutorial on how to use your tool?


Setup-PS_Tileset.tp2 is a working example that displays almost all of the functionality offered by the tool, plus it intentionally uses some bad inputs (where noted in the comments) to show that it handles them properly. That main TP2 file has inline comments explaining what each call to the function library is doing, plus I tried to make sure the library itself (ps_tileset_lib.tpa) was well commented. If you have specific questions, I'd be happy to answer them the best I can.

Link to post
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...