I need to populate existing FLT files with a bunch of new textures, but using mgInsertTexture starts with the last free entry in palette 0 and spams everything from there. What I really need is some way of getting all the new textures in using mgInsertTexture, but starting in palette 5, or 7 (for example). ie. I like the way mgInsertTexture allocates a palette entry and fills it in, but is there a way to determine where it starts?
There is also mgReadTexture... This function takes a few extra parameters compared to mgInsertTexture. It allows you to specify what index to assign to the texture palette entry as well as the x and y pixel location of the texture in the palette. The difficult part of this function is determining where to place the textures. You can be very sophisticated and calculate a nice packing, or you can just place them all at 0,0 so they overlap. If it were me, I would read them all in at location 0,0, then just use the Creator Script command to pack all texture palettes, or just pack the current texture palette. You also might want to check to make sure the index is not already in use.
Ah good point. I don't know why I'd overlooked that. I can do an mgGetNextTexture to find the last palette entry then round up to start at the next one.