Word Rescue Level Format

From ModdingWiki
Jump to: navigation, search
Word Rescue Level Format
320px
There is no image of a map in this format — upload one!
Format typeMap/level
Map type2D tile-based
Layer count2
Tile size (pixels)16×16 and 8×8
Viewport (pixels)288×152
GamesWord Rescue
Word Rescue stores its levels in files named WRx.Sy where x is the episode (1-3) and y is the level (starting at 0). WR1.S0 is episode 1 level 1, WR3.S11 is episode 3 level 12. A matching equivalent WRx.Dy is used for the attribute layer.

The format is comprised of two layers and some items (perhaps considered a third layer) with the first (background) layer having 16×16 tiles and the second (attribute) layer having 8×8 tiles.

File format

Each file begins with a header.

Data type Description
UINT16LE mapWidth Width of map, in 16×16 tiles
UINT16LE mapHeight Height of map, in 16×16 tiles
UINT16LE bgColour Background colour (EGA 0-15)
UINT16LE tileset Number in tileset filename (e.g. 0x03 == back3.wr)
UINT16LE backdrop Number in backdrop filename (e.g. 0x04 == drop4.wr)
UINT16LE startX X-coordinate of starting position (in 8×8 tiles)
UINT16LE startY Y-coordinate of starting position (in 8×8 tiles)
UINT16LE endX X-coordinate of level exit door (in 8×8 tiles)
UINT16LE endY Y-coordinate of level exit door (in 8×8 tiles)
UINT16LE gruzzleCount Number of gruzzles in level
WR_COORD gruzzles[gruzzleCount] Gruzzle coordinates (see below)
UINT16LE unknownCount  ?
WR_COORD unknown[unknownCount]  ?
UINT16LE slimeCount Number of slime buckets in level
WR_COORD slimeBuckets[slimeCount] Slime bucket coordinates
UINT16LE bookCount Number of books in level
WR_COORD books[bookCount] Book coordinates
WR_COORD letters[7] Coordinates of letters in word to spell
UINT16LE animCount Number of animated tiles
WR_COORD animations[animCount] Animated tile coordinates
UINT16LE end 0x0000

The WR_COORD data type is defined as follows. As shown above it is preceded by a count, with the two fields (X and Y) being repeated that many times. If the associated count is zero, the WR_COORD structure is omitted entirely.

Data type Description
UINT16LE x X-coordinate (in 16×16 tiles)
UINT16LE y Y-coordinate (in 16×16 tiles)

The background layer of map data follows next. The data is stored in a basic and quite inefficient RLE coding. Data is stored as a pair of two bytes. The first byte is a count (often one) and the second byte is the value to repeat that many times. Values (second bytes) of 0xFF refer to transparent/background tiles. After expansion there will be mapWidth * mapHeight bytes/tiles.

Immediately following this is the attribute layer, again RLE compressed in the same manner. This layer uses 8×8 tiles instead, so after expansion there will be (mapWidth - 1) * mapHeight * 4 bytes/tiles. The tiles are positioned from X-coordinate 1 (rather than 0), so it is not possible to place tiles in the first column (where x is zero). However because the tiles are 8×8, those at x=1 still overlap the 16×16 background tile at x=0.

The level entrance and exit are also specified in units of 8×8 tiles. The entrance coordinates are of the bottom-middle of where the door image is drawn, and where the player's feet will appear. The exit coordinates are of the top-left of the door image. The door image is 32×40 pixels in size.

Tile mapping

The tileset used is specified in the header (see above.) Each tileset is a 320×200 16-colour PCX file, divided up into 16×16 tiles.

The tile code in the background layer refers directly to an index in the tileset (so a value of 0 refers to the first 16×16 tile in the PCX file.)

! Describe how animated tiles work

The tile codes in the attribute layer seem to be constants:

Value Purpose
0x00 First question-mark box
0x01 Second question-mark box
0x02 Third question-mark box
0x03 Fourth question-mark box
0x04 Fifth question-mark box
0x05 Sixth question-mark box
0x06 Seventh question-mark box
0x20 Empty space
0x73 Solid tile
0x74 Standing tile (can jump up through it or press down to fall through it)
0xFD Unknown (end of layer?)

Credits

This format was reverse engineered by Malvineous. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)

Personal tools
programming