Gravity Beam Tools Documentation

7th May 2012

I've written several shims in C and Javascript to automate things like graphics and level processing.

I use tinyc to compile the C programs as Windows commandline executables.


imageprocessor

Converts image files to a non/interleaved bitplane format easily displayable/blittable on the Amiga.

Usage

Format: imageprocessor.exe inputname outputname width height bitplanes interleaved

inputname is a RAW image file. A RAW image file is a 256 colour paletted image that contains a series of unsigned bytes representing palette indices.

outputname will be a binary file containing the bitplaned image. The program will overwrite this file silently if it exists.

width is the width of the input image in pixels. This should be a multiple of 16.

height is the height of the input image in pixels.

bitplanes is the number of bitplanes in the image. This can be any number, but I use 3 bitplanes in Gravity Beam and you definitely shouldn't try to use more than eight.

interleaved is 0 or 1. If 0, then the bitplanes will be output sequentially as blocks (row 0 bit 0, row 1 bit 0, row 2 bit 0... row 0 bit 1). If 1, then the bitplanes will be output interleaved (row 0 bit 0, row 0 bit 1, row 0 bit 2, row 1 bit 0, etc.).

Example

imageprocessor marsbackgroundextended.raw 3bit_marsbackgroundextended.bin 320 240 3 1

Convert the RAW image marsbackgroundextended.raw into the binary 3bit_marsbackgroundextended.bin. The output image will be an interleaved bitplaned image of 28800 bytes (320 bits across * 240 pixelrows * 3 bitplanes / 8 bits per byte).


imageviewer

Decodes bitplaned images and outputs the bit activation grids to the console.

Usage

Format: imageviewer.exe inputname width height bitplanes interleaved

inputname is a bitplaned binary image file.

width is the width of the input image in pixels. This should be a multiple of 16.

height is the height of the input image in pixels.

bitplanes is the number of bitplanes in the image.

interleaved is 0 or 1. If 0, then the bitplanes should be sequentially stored. If 1, then the bitplanes should be interleaved.

Example

imageviewer spaceships9.raw 3bit_spaceships.bin 16 352 3 1

Views the binary bitplane image 3bit_spaceships.bin and outputs it to the console:

Encoded image is 2124 bytes.
Read 0 bytes
......0.........
......1.........
................
......0.........
......1.........
................
.....0.0........
.....1.1........
......2.........
.....0.0........
.....1.1........
......2.........
....0.0.0.......
....1.111.......
.....2..........
....0.0.0.......
....1.111.......
.....2..........
...0.000.0......
...1.11111......
....2...........
...0.000.0......
...1.11111......
....2...........
..0.00.0..0.....
..1.11.1111.....
...2..2.........
..0000..000.....
..1111.1111.....
......2.........

This is the bit activations for the first frame of the spaceship sprite. The first row shows the bit values for bit 0, the second bit 1 and the third bit 2.

You can see the shape of the ship more clearly if you scroll down to the mask:

......0.........
......1.........
......2.........
......0.........
......1.........
......2.........
.....000........
.....111........
.....222........
.....000........
.....111........
.....222........
....00000.......
....11111.......
....22222.......
....00000.......
....11111.......
....22222.......
...0000000......
...1111111......
...2222222......
...0000000......
...1111111......
...2222222......
..000000000.....
..111111111.....
..222222222.....
..000000000.....
..111111111.....
..222222222.....

The mask should have 'all active' for every pixel where the sprite should be drawn, as you can see above.


sinetablemaker

Makes maths tables as binary data arrays for inclusion.

Currently it's set up to output a sinetable as 256 entry array of word values in 1.1.14 big endian fixed point.