.inc file tile rotator

Topics on software tools like TileStudio, comments on documentation and tutorials (or the lack of) should go here.

.inc file tile rotator

Postby mapes » Mon May 16, 2011 11:12 pm

I thought I'd whip a quick program up to rotate .inc tile files clockwise and counter clockwise easily.

You have to remove the last comma from the file or it won't work. I didn't want to go through the extra coding hassle for detecting the last exception for a simple comma.

I mainly wrote this because many game files distributed for the UzeBox are only the .inc files only, and not the actual image itself. It was pretty simple to do in VB.net. (unlike programming a video game) :lol:

-Mapes
Attachments
RotateTiles.zip
RotateTiles V.1
(10.38 KiB) Downloaded 23 times
User avatar
mapes
 
Posts: 119
Joined: Sun Feb 13, 2011 7:04 am
Location: Seattle

Re: .inc file tile rotator

Postby uze6666 » Thu May 19, 2011 9:29 pm

Hi mapes,

I'm not sure to understand what you tool does exactly. Can you elaborate?

-Uze
User avatar
uze6666
Site Admin
 
Posts: 2672
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada

Re: .inc file tile rotator

Postby mapes » Fri May 20, 2011 5:29 am

uze6666 wrote:Hi mapes,

I'm not sure to understand what you tool does exactly. Can you elaborate?

-Uze


Sure,

I've been looking at the source code for several games, such as space invaders and noticed that there were no graphic files included with the files. All of the graphics were converted to text in tiles or sprite "*.inc" files.

I looked at the format used by space invaders of 8X8 tiles and wrote a program to rotate the text file tiles clockwise or counter clockwise.

However, I noticed later that this won't work on several other games that don't use the same format, Meaning that although the format is received the same when compiling "Syntax", the program I wrote doesn't parse it correctly.

For the program to work, the .inc file needs the tiles to be formatted in this fashion:

0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,

And a clock wise rotation would make it like this:

0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,

Because this is written in a 8X8 matrix form in text, the program parses each pixel into an array and then rotates, and pastes it into a new file adding .ccw ( counter clockwise) or .cw (clockwise) to the end of it.

The way it parses the data into an array is by separating it out by the commas (,). The program isn't configured to input more than 8 pixels per row for the rotation, but could if there is requests for it.

Since we don't have the graphic files, I thought this would be a useful tool in the future if the Uzebox Jamma takes off for easily converting all of the graphics to vertically set up monitors.

Hopefully this gives you a better idea of what the tool does, and when it would be used.
User avatar
mapes
 
Posts: 119
Joined: Sun Feb 13, 2011 7:04 am
Location: Seattle


Return to Tools, Documentation & Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron