Wacky Wheels Graphics Formats

From ModdingWiki
Jump to navigation Jump to search

This page describes the formats and files used to display graphics in Wacky Wheels.

PCX graphics

Many of the graphics in Wacky Wheels are in PCX Format. The uses of most PCX files are self-explanatory.The files a_f*.pcx, ma_f*.pcx and beach.pcx are described below. PCX graphics can be edited in many image editors, but you need to pay attention to the color palettes used. Details are in the color palettes section below.

Tile appearance and properties

  • a_f*.pcx: Tile graphics
  • a_ma*.pcx: Selects tile properties for each pixel in each tile of the tile graphics files
  • n.gam: Chooses the primary and secondary tile graphics files and property files (among other things) for track n
  • n.sin: Sets tile properties 0 and 1 for each tile in track n

For each track, there are 108 possible tiles to use. The graphics for these tiles are contained in the tile graphics files (a_f*.pcx) (see also Color palettes). Each tile graphics file contains 54 tiles, each 32×32 pixels. The primary graphics file contains tiles 0–53 and the secondary graphics file contains 54–107. The first tile is in the top left, and they are in order left to right and top to bottom. Tile #1 is the one used outside the track.

The tile properties files (a_ma*.pcx) are laid out in the same way as the graphics files. The colors in any tile must be in the first two positions of the color palette. (The colors assigned to the color palette are not used—only the indices.) In track n, any pixel in tile m that is color #0 will have property #0 specified in struct m of the file n.sin; similarly for color #1.

See Wacky Wheels Track Format for the format of the *.gam and *.sin files.

Color palettes

The color palette used in each race is mostly the one set in the primary tile graphics file a_f*.pcx. This palette is also used when showing the preview map before the race. The palettes set in the other PCX files are not used. However, if color cycling is enabled in *.gam, some color indices are assigned to color cycles. An example is the shoreline in regular bronze wheels track 2. Along the shore, the colors cycle between various shades of blue and sometimes brown. These color cycles are selected with their corresponding color index. For a_f3.pcx, these indices are 148, 161–164 and 168–175. The colors set in the palette for these indices are used when displaying the preview map, or when color cycles are disabled in the *.gam file.

The color palette used in the color cycles is colors 0–76 in the palette of beach.pcx. The progression of color indices assigned to each color cycle of a_f*.pcx may be hard-coded into the program. The image in beach.pcx doesn’t seem to be used. There are two 32x32 squares in the image that contain a pattern of color indices from 166–175, although if you blank the entire image, the color cycles work the same as ever. (Change the colors assigned to indices 166–175 to see the pattern.)

Looking at the existing a_f*.pcx files, colors 0, 3–4, 10–111, 127–128 and 255 are always the same or nearly the same. You can safely edit any other colors in the palette without affecting the display of the sprites or screen overlays. You can probably find some other colors that are unused, or change the palette colors used in the sprites if you need more colors than that.

Note that the Gimp doesn’t like having the same color assigned to multiple indices in the palette. For example, if you open a_f3.pcx in the Gimp, and copy and paste the deep water tile (tile #27) to tile #0 (grass), the Gimp will copy the colors over and select the first index in the palette that matches each color. This is definitely not what you want, since some indices are animated. To work around this, I slightly changed the values of some of the colors, so that the Gimp would see them as being unique.

Sprites

sprite.atr

The file sprite.atr is the index of all of the sprites that can be used as objects in the game maps. The first two bytes of this file are an INT16LE giving the number of structs that follow. Each struct is 40 bytes long and has this format:

Data type Name Description
INT16LE type Type of item pickup. See table.
INT16LE unknown No apparent use. Always 0x0a.
INT16LE width1 Sprite width in pixels
INT16LE height1 Sprite height in pixels
INT16LE width2 Always equal to width1.
INT16LE height2 Always equal to height2.
INT16LE size_index 1 if size is 28×28; 2 if size is 14×28; 3 if size is 32×24. Other values are unknown.
INT16LE frames Number of frames in sprite file (for animation)
char[24] filename Name of the file containing the sprite
Index Item pickup type
0 None (not an item pickup)
1 Tires (used when you run over a stack of tires)
2 Four hedgehogs
3 Fireballs
4 Devil pups
5 Bomb
6 Oil slick
7 Upside down hog
8 Ice cube

Setting size_index = 4 appears to work but I haven’t figured out what size it selects or how high the size index goes.

Changing width2 and height2 doesn’t appear to have any effect.

The file name will be no more than 12 characters long (an 8.3 character DOS file name). The remaining bytes in the string are filled with zeros. Sprites are placed on the map using their index in the sprite.atr file. The first sprite file listed has index 0. See Where objects are placed – *.spw.

The default sprite.atr file lists 36 files. The tables below list what sprites are in each *.sp file listed, and their index in sprite.atr. The files h3.sp and h13.sp do not exist, so are skipped in sprite.atr.

Index File name Description
0 h1.sp Matchbox
1 h2.sp Newspaper hedgehog
2 h4.sp Sweeping hedgehog
3 h5.sp Demolition hedgehog
4 h6.sp Toilet hedgehog
5 h7.sp Jackhammer hedgehog
6 h8.sp Dancing hedgehog
7 h9.sp Yo yo hedgehog
8 h10.sp Machine gun hedgehog
9 h11.sp Jumping jacks hedgehog
10 h12.sp Bomb
11 h14.sp Rock pick hedgehog
12 h15.sp Devil pups
13 h16.sp Oil can
14 h17.sp Guard hedgehog
15 h18.sp Bouncing ball hedgehog
16 h19.sp Golfing hedgehog
17 h20.sp Upside down hog (item pickup)
18 h21.sp Dice hedgehog
19 h22.sp Weightlifting hedgehog
20 h23.sp Backflip hedgehog
21 h24.sp Trench coat hedgehog
22 h25.sp Pool hedgehog
Index File name Description
23 ob1.sp Stack of tires
24 ob2.sp One cattail plant
25 ob3.sp Wooden pole with white and red stripes
26 ob4.sp Cactus
27 ob5.sp Red barrel
28 ob6.sp Yellow barrel
29 ob7.sp Green barrel
30 ob8.sp Tires stacked over wooden pole
31 ob9.sp Three cattail plants
32 ob10.sp Yellow and gray striped pole
33 ob11.sp Yellow and red striped pole
34 ob12.sp Bush
35 ob13.sp Wooden pole


*.sp

The *.sp sprite files are raw image data (8bpp, no header or image size). Each byte is a pixel, and the value of the byte gives the index to use in the track’s palette.

If your image editor supports reading raw image data, you can open the *.sp files by specifying the width and height, 8 bits per pixel, indexed colors, and then applying the appropriate color palette. Then rotate the image 90° clockwise and flip the image horizontally. Some *.sp files have multiple sprites of varying widths, so you’ll need to specify a file offset and length along with the width and height.

To use a sprite file as an object on the track, it needs to be listed in sprite.atr.

Horizon graphics – *.par

The *.par files contain the graphics to draw on the horizon (such as buildings or mountains). Like the *.sp files, they are raw image data, where each byte is a pixel and specifies which color palette index to use. The color palette used is the main track color palette. Each *.par file is 640×40 pixels. Unlike the *.sp files, they do not require rotation or flipping when opening them as raw image data in an image editor.