STYLE00x.GRY
Files
Fil_Style00x.gry.html

Name

STYLE001.GRY, STYLE002.GRY, STYLE003.GRY - contains 8-bit textures for each city map

Location

gtadata\style00?.gry

Availability

all GTA Demos, GTA Full Version

Description

This file contains the graphical information for the game when running in 8-bit graphics mode. Textures for faces of cubes (sides and lids including signs, animations for doors) make up one section, textures for objects, cars, explosions, and people make up another section. Textures for 24-bit modes are in the style000x.g24 files.

Header

The first 52 bytes in the file contain 13 Integers (32-bit). I call them h0 through h12. h0 is a version code to recognize style00?.gry files by, and should always equal 325. h1 through h12 set the lengths of different parts of the file (see below).

Structure of STYLE00?.GRY


Example: Style001.gry

Section

Position

Length

Position

Length

Header

0

52

0

52

Side tile textures

52

h1

52

798720

Lid tile textures

52+h1

h2

interlaced

630784

Auxiliary tile textures

52+h1+h2

h3

interlaced

126976

n blank tiles, 0<=n<4

4096*n


interlaced

8192

Synchronous Animation


h4

1556532

36

RGB master palette


h5

1556568

768

Remap Tables


h6

1557336

65536

Remap Index


h7

1622872

1024

Object Index


h8

1623896

2040

Cars


h9

1625936

6972

Sprite Info


h10

1632908

12388

Sprite Graphics


h11

1645296

1062750

(including Deltas)


h11

2628336

79710

Sprite Numbers

EOF-h12

h12

2708046

42

File Size

EOF

0

2708088

0

Tile Textures

The tile textures form 3 sections:

  • Sides=vertical tiles: walls of buildings, sides of bridges, street and building signs, fences etc.

  • Lids=horizontal tiles: ground, rooftops, streets, railways, water, bridge girders, fire escapes etc.

  • Auxiliary=animation phase tiles: roof fan, rollup door, blinking bar sign

Some of these tiles have a transparent background, e.g. bridge girders or street signs.

The Tile Textures are 64x64 pixels large. They are interlaced in groups of 4 in the following way (each Bracket stand for 64 bytes, t=tile, r=row, each tile has 64 rows):
<t0r0><t1r0><t2r0><t3r0><t0r1><t1r1><t2r1>
<t3r1><t0r2><t1r2><t2r2><t3r2>...

The sections do not usually have multiples of 4 tiles; as a result tiles from two neighboring sections are interlaced as if they belonged to the same section. If necessary, the last row of the auxiliary section is filled with empty tiles to make it 4 tiles.

Example

The horizontal tile section in style001.gry has 630784 bytes; that's 630784/(64*64)=154 tiles. All 3 sections have 1556480 bytes=380=4*95 tiles.

To view style001.gry in PaintShopPro, open it as RAW file [Header=52, width=256, height=6080, grayscale].

You can also view GIFs of the Horizontal Tile section of style001.gry (4x40KB).

Synchronous Animation

Some tiles are continuously animated (water, fans), while others are only animated if needed (doors, mostly). Only continuous animation is defined here. Animation works by taking a tile from the sides or lids section (see above) and adding animation phase tiles from the auxiliary section to it. GTA rotates through them, starting with the original tile and changing the image every f frames.

The animation data contains only Byte values. The first byte specifies the number of animations that follow. The animations are stored immediately after this. The animations have the following structure:

b: block number (in side or lid section)

s: if s=0, b refers to the side section; if s=1, b refers to the lid section.

f: number of frames to wait between each phase change (speed); f*0.04=delay in seconds

n: number of phases

p1: first phase block number (refers to auxiliary section)

...

p(h3): number for phase h3


b: block number of next animation

s: ...

...

Example (style001.gry):

5 = 5 animations here

Water Animation First animation:

41 1= Block 41 in lid section

7 = change phase every 0.28s

6 = 6 phases follow

25 26 27 28 29 30 = block numbers in aux section for the phases

Blinking Bar Animation Last (fifth) animation:

96 0 = Block 96 in Sides Section

16 = change phase every 0.4s

1 = 1 phase follows

9 = block number in aux section




RGB master palette

Style001.gry Palette At the end, GTA uses this palette to display all of its graphics in 8-bit mode. If you do a screendump in 8-bit mode, the pictures will have this palette. However, cars, pedestrians, objects and tile lids may use a different ordering of this palette as defined by the Remap Tables.

The Palette contains RGB triples in the following byte sequence:

r0 g0 b0 r1 g1 b1 ....  r255 g255 b255
Each color channel has only 6 bits, resulting in a 0-63 range; all values must be multiplied by 4 to yield the usual 0-255 range.
Caution: The Palette may possibly contain fewer than 256 colors.

Remap Tables

These 256x256=65536 bytes are key to remapping the object tile textures palettes to the master palette. What makes this guess more probable is that most of these lines contain the numbers 0-256 in ascending order; yet there are 21+14+60=95 256-byte lines that differ from this pattern. It so happens that the texture section has 95 lines of 4 tiles each. Coincidence?
Another guess: water can have different shades, and so can sidewalk. Yet there is only one water tile in the file (in fact, there are 7, but they all belong to the same animation which you can see if you mark them or use single frame mode (+) in the porkcharsui cheat). So perhaps the other shades are produced by remapping their palette!

Unidentified sections

I have no clue what is in these sections and where they are in the file. The "missing bytes" section is just the difference between the file size and the sum of h0-h12 plus the length of the object texture section.

Object Textures

The object texture tile size is 256x256. However, the individual objects are irregularly embedded in these tiles. Somewhere in the file must be the information that describes the rectangular areas that form these objects. [The precincts of the cities are described by x/y of upper left-hand corner and width and height of the rectangle.]

style001.gry has 15 of these tiles.

To view them in PaintShopPro, open it as RAW file [Header=240, width=256, height= 10266, grayscale] and scroll all the way down.

You can also view GIFs of 3 object texture tiles of style001.gry (4x25KB).

Unidentified section

I have no clue what is in this section.

Unidentified Section

18 00 00 00 - 01 00 00 00 - 06 00 1B 00 - 32 02 27 01
00 00 02 00 - 06 00 05 00 - 00 00 1A 00 - 00 00 00 00
07 00 30 00 - 00 00 00 00 - 00 00
Find out what these 42 bytes from style001.gry mean because I don't know!

See also:

Section 3 of the CityScape Data Structure document, available from the DMA website, deals with Style Data. It contains, at the time of this writing, a few inaccuracies (version 12).

Notes

Information contributed by Ian Howson and Michael Mendelsohn.

Bugs

CityScape document info not yet fully integrated. The *.G24 files should have a similar structure although they have no header.

STYLE00x.GRY

Last change: 26 Apr 1998

unofficial GTA Reference