-
Notifications
You must be signed in to change notification settings - Fork 1.7k
G1 Elements Layout
A G1 element is typically a sprite. It is basically an image.
There would appear to be two image formats that the G1 element can be.
Run length encoded element.
The first y words are offsets to the corresponding y line. You use this to jump to the correct line if you do not require info from the first line.
[line 0 offset][line 1 offset] ...
[word][word] ...
When you have jumped to the correct line there are 2 bytes that inform you of the number of bytes in the next data section and the number of pixels it represents after it (gap length). The reason there are two values for representing the pixels is for empty pixels. To draw the correct image you have to do each section and remember to jump over each gap on the drawing surface. The gap is measured from the left edge of the sprite, not from the last group of pixels. The next line will start immediately at the end of the previous line. If the most significant bit of the no. bytes field is set then this the last data section of a line and a new line will start after this data section.
line0:[no. bytes in data 1][gap length 1][data 1 of no. bytes length][no. bytes in gap 2]...line1:...
[byte][byte][bytes*no.bytes][byte]...
Example G1 Element 4x4 pixels.
0000: 0x0008,0x000F,0x0015,0x0018 ;4 words in line offsets
0008: 0x01,0x01,0xff,0x82,0x00,0xa1,0xff ;7 bytes in line 0
000F: 0x84,0x00,0xff,0xff,0xa1,0xff ;6 bytes in line 1
0015: 0x81,0x03,0xff ;3 bytes in line 2
0018: 0x81,0x03,0xa1 ;3 bytes in line 3
Total bytes: 27
Final image. Note that blank areas will be whatever the current drawing area is.
blank, 0xff, 0xa1, 0xff
0xff, 0xff, 0xa1, 0xff
blank, blank, blank, 0xff
blank, blank, blank, 0xa1
Total bytes of info: 32 (Assumes 1 byte for if blank or not)
Note that the final image has more bytes than the original image. For larger images with more blank areas this saving is bigger. We can therefore conclude that this technique was probably used to save on file size.
The second type is not compressed and it is a simple one to one relationship.
The drawing code also uses palettes to translate some of the colours. This is used for example with security guards to change their top colour. There are two palettes that are not loaded and are modified throughout the code (0x9ABE0C and 0x9ABF0C)
- Home
- FAQ & Common Issues
- Roadmap
- Installation
- Building
- Features
- Development
- Benchmarking & stress testing OpenRCT2
- Coding Style
- Commit Messages
- Overall program structure
- Data Structures
- CSS1.DAT
- Custom Music and Ride Music Objects
- Game Actions
- G1 Elements Layout
- game.cfg structure
- Maps
- Music Cleanup
- Objects
- Official extended scenery set
- Peep AI
- Peep Sprite Type
- RCT1 ride and vehicle types and their RCT2 equivalents
- RCT12_MAX_SOMETHING versus MAX_SOMETHING
- Ride rating calculation
- SV6 Ride Structure
- Settings in config.ini
- Sizes and angles in the game world
- Sprite List csg1.dat
- Sprite List g1.dat
- Strings used in RCT1
- Strings used in the game
- TD6 format
- Terminology
- Track Data
- Track Designs
- Track drawers, RTDs and vehicle types
- Track types
- Vehicle Sprite Layout
- Widget colours
- Debugging OpenRCT2 on macOS
- OpenGL renderer
- Rebase and Sync fork with OpenRCT2
- Release Checklist
- Replay System
- Using minidumps from crash reports
- Using Track Block Get Previous
- History
- Testing