Difference between revisions of "LGR/Technical"
m (Mask is too complicated error) |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Technical information for Elasto Mania LGR files. | + | Technical information for Elasto Mania LGR files. Some additional info at [[Lgrdk]]. |
== .LGR File Format == | == .LGR File Format == | ||
Line 22: | Line 22: | ||
| style="text-align:right;" | 17+18*l|| int*l || style="text-align:right;" | 4*l || '''Pictures.lst:''' Default clipping (0=Unclipped, 1=Ground, 2=Sky) | | style="text-align:right;" | 17+18*l|| int*l || style="text-align:right;" | 4*l || '''Pictures.lst:''' Default clipping (0=Unclipped, 1=Ground, 2=Sky) | ||
|- | |- | ||
− | | style="text-align:right;" | 17+22*l || int*l || style="text-align:right;" | 4*l || '''Pictures.lst:''' Location of transparent pixel (11= | + | | style="text-align:right;" | 17+22*l || int*l || style="text-align:right;" | 4*l || '''Pictures.lst:''' Location of transparent pixel (10=whole image is solid (only valid for masks; throws error for pictures), 11=palette color 0 is the transparent color, 12=topleft, 13=topright, 14=bottomleft, 15=bottomright) |
|- | |- | ||
| style="text-align:right;" | 17+26*l || Object || style="text-align:right;" | ? || List of x pcx objects of variable length (see Pcx Object below) | | style="text-align:right;" | 17+26*l || Object || style="text-align:right;" | ? || List of x pcx objects of variable length (see Pcx Object below) | ||
Line 34: | Line 34: | ||
! Offset || Type || Bytes || Description | ! Offset || Type || Bytes || Description | ||
|- | |- | ||
− | | style="text-align:right;" | 0 || char[12] || style="text-align:right;" | 12 || Filename including .pcx, null terminated (e.g. "barrel.pcx"+[0,0] or "plantain.pcx") | + | | style="text-align:right;" | 0 || char[12] || style="text-align:right;" | 12 || Filename including .pcx, null terminated (e.g. "barrel.pcx"+[0,0] or "plantain.pcx"). Note that after the first [0], there may be garbage characters in old lgrs (e.g. "flag.pcx"+[0,0x10,0x54,0x4C]) |
|- | |- | ||
| style="text-align:right;" | 12 || byte[8] || style="text-align:right;" | 8 || [0x00, 0x95, 0x4C, 0x00, 0x98, 0x95, 0x4C, 0x00]. Only the first byte is important as 0x00 signifies the end of the filename from the previous row. The other bytes are unused. | | style="text-align:right;" | 12 || byte[8] || style="text-align:right;" | 8 || [0x00, 0x95, 0x4C, 0x00, 0x98, 0x95, 0x4C, 0x00]. Only the first byte is important as 0x00 signifies the end of the filename from the previous row. The other bytes are unused. | ||
Line 40: | Line 40: | ||
| style="text-align:right;" | 20 || int || style="text-align:right;" | 4 || Length of the .pcx file in bytes (z) | | style="text-align:right;" | 20 || int || style="text-align:right;" | 4 || Length of the .pcx file in bytes (z) | ||
|- | |- | ||
− | | style="text-align:right;" | | + | | style="text-align:right;" | 24 || byte[z] || style="text-align:right;" | z || Raw contents of original .pcx file |
|} | |} | ||
Line 69: | Line 69: | ||
*q2up_arm.pcx | *q2up_arm.pcx | ||
*q2head.pcx | *q2head.pcx | ||
− | * | + | *qflag.pcx |
*qkiller.pcx | *qkiller.pcx | ||
*qexit.pcx | *qexit.pcx | ||
Line 77: | Line 77: | ||
=== Special filenames included in Pictures.lst === | === Special filenames included in Pictures.lst === | ||
− | These items are handled specially in elastomania, but must be included in Pictures.lst | + | These items are handled specially in elastomania, but must be included in Pictures.lst. While they theoretically have properties such as distance etc., these properties are ignored during lgr loading. Transparency is hardcoded to be the topleft pixel for these files. |
*qup_*.pcx, where * is any text | *qup_*.pcx, where * is any text | ||
*qdown_*.pcx, where * is any text | *qdown_*.pcx, where * is any text | ||
Line 106: | Line 106: | ||
*q2up_arm.pcx | *q2up_arm.pcx | ||
*q2head.pcx | *q2head.pcx | ||
− | * | + | *qflag.pcx |
*qkiller.pcx | *qkiller.pcx | ||
*qexit.pcx | *qexit.pcx | ||
Line 120: | Line 120: | ||
* The raw contents of each .pcx file must be between 1-10,000,000 bytes in length | * The raw contents of each .pcx file must be between 1-10,000,000 bytes in length | ||
* The maximum filename length is 8 characters, excluding ".pcx" | * The maximum filename length is 8 characters, excluding ".pcx" | ||
+ | * The filename must end in ".pcx" (or ".spr") | ||
=== Pictures === | === Pictures === | ||
* The maximum number of pictures is 999 | * The maximum number of pictures is 999 | ||
* The maximum picture width is 6000 (does not apply to masks/textures) | * The maximum picture width is 6000 (does not apply to masks/textures) | ||
− | * '''The maximum picture size (width*height) is 600,000''' (e.g. 775*775 is too large) (does not apply to masks/textures) | + | * '''The maximum picture size (width*height) is 600,000''' (e.g. 775*775 is too large) (does not apply to masks/textures) -> further testing reveals that some pictures can be slightly larger than 600,000, but some cannot. I'm not sure what exactly is being counted to 600,000, but all I know is that below 600,000 is for sure safe, whereas most pictures crash above 600,000. Increased zoom will also increase picture size, meaning that if you have very large images in your lgr file, it may not be compatible with increased zoom. |
* There may be no duplicate picture names | * There may be no duplicate picture names | ||
=== Textures === | === Textures === | ||
− | * | + | * There must be 2-99 textures. |
− | * qgrass.pcx counts as a texture | + | * qgrass.pcx counts as a texture (it is included in the 2-99 limit) |
* There may be no duplicate texture names | * There may be no duplicate texture names | ||
=== Masks === | === Masks === | ||
* The maximum number of masks is 199 | * The maximum number of masks is 199 | ||
− | * There exists a "mask is too complicated" error | + | * There exists a "mask is too complicated" error. An example of a mask that is too complicated is a mask alternating every pixel as solid/transparent/solid/transparent of medium size. Increased zoom can also make otherwise acceptable masks throw this error. |
* There may be no duplicate mask names | * There may be no duplicate mask names | ||
Line 141: | Line 142: | ||
=== Bike/kuski .pcx files === | === Bike/kuski .pcx files === | ||
− | The following .pcx files are limited to a width of 255 and a height of 255 | + | The following .pcx files are limited to a width of 255 and a height of 255. I think they are all stretched as described in [[Big_Book_of_Elma_Facts#LGR_tricks.2C_Part_1]]. |
*q1body.pcx | *q1body.pcx | ||
*q1thigh.pcx | *q1thigh.pcx | ||
Line 162: | Line 163: | ||
*qflag.pcx | *qflag.pcx | ||
− | Q1bike.pcx and q2bike.pcx are handled specially: [[Big_Book_of_Elma_Facts#LGR_tricks.2C_Part_1]] | + | Q1bike.pcx and q2bike.pcx are handled specially: [[Big_Book_of_Elma_Facts#LGR_tricks.2C_Part_1]]. If the bike image is too small, the bike will simply be invisible or black, but no error will occur. |
=== Object .pcx files === | === Object .pcx files === | ||
Line 169: | Line 170: | ||
* The maximum number of frames is 1000 (however, I think the .pcx file format breaks down before reaching a width of 40,000) | * The maximum number of frames is 1000 (however, I think the .pcx file format breaks down before reaching a width of 40,000) | ||
* If the height of the .pcx file is greater than 40, all the rows past the 40th are ignored and not drawn | * If the height of the .pcx file is greater than 40, all the rows past the 40th are ignored and not drawn | ||
+ | * If the height of the .pcx file is less than 40, the missing rows will be read as garbled data, usually leading to a crash | ||
+ | * Qfood*.pcx must be entered in order. If a number is missing, no more files will be loaded. (e.g. if qfood 1, 2, and 5 exist, only 1 and 2 will be loaded) | ||
== QGRASS.pcx == | == QGRASS.pcx == |
Latest revision as of 05:39, 24 May 2017
Technical information for Elasto Mania LGR files. Some additional info at Lgrdk.
.LGR File Format
Offset | Type | Bytes | Description |
---|---|---|---|
0 | char[5] | 5 | "LGR12" for LGR files. (12 refers to the version of LGR file) |
5 | int | 4 | Number of .pcx files contained at the end of the LGR file (x) |
9 | byte[4] | 4 | Pictures.lst: identification header: [0xEA, 0x03, 0x00, 0x00] (required to be a valid file) |
13 | int | 4 | Pictures.lst: Number of elements in .lst file (l) |
17 | char[10]*l | 10*l | Pictures.lst: List of image names, null terminated (e.g. "barrel"+[0,0,0,0]). The maximum name length is 8. |
17+10*l | int*l | 4*l | Pictures.lst: Image type (100=picture, 101=texture, 102=mask) |
17+14*l | int*l | 4*l | Pictures.lst: Default distance (1-999). (Masks have a distance of 0. QUP_/QDOWN_/qfood have distances of 400 - apparently unused?) |
17+18*l | int*l | 4*l | Pictures.lst: Default clipping (0=Unclipped, 1=Ground, 2=Sky) |
17+22*l | int*l | 4*l | Pictures.lst: Location of transparent pixel (10=whole image is solid (only valid for masks; throws error for pictures), 11=palette color 0 is the transparent color, 12=topleft, 13=topright, 14=bottomleft, 15=bottomright) |
17+26*l | Object | ? | List of x pcx objects of variable length (see Pcx Object below) |
? | byte[4] | 4 | End of file marker: [0xE7, 0x05, 0x2E, 0x0B] |
Pcx Object
Offset | Type | Bytes | Description |
---|---|---|---|
0 | char[12] | 12 | Filename including .pcx, null terminated (e.g. "barrel.pcx"+[0,0] or "plantain.pcx"). Note that after the first [0], there may be garbage characters in old lgrs (e.g. "flag.pcx"+[0,0x10,0x54,0x4C]) |
12 | byte[8] | 8 | [0x00, 0x95, 0x4C, 0x00, 0x98, 0x95, 0x4C, 0x00]. Only the first byte is important as 0x00 signifies the end of the filename from the previous row. The other bytes are unused. |
20 | int | 4 | Length of the .pcx file in bytes (z) |
24 | byte[z] | z | Raw contents of original .pcx file |
Pictures.lst contents
The format of pictures.lst is described above.
Items excluded from Pictures.lst
All files should be present both as an entry in pictures.lst and as a Pcx Object, except the following, which should only present as Pcx Objects as elastomania handles these files specially:
- q1body.pcx
- q1thigh.pcx
- q1leg.pcx
- q1bike.pcx
- q1wheel.pcx
- q1susp1.pcx
- q1susp2.pcx
- q1forarm.pcx
- q1up_arm.pcx
- q1head.pcx
- q2body.pcx
- q2thigh.pcx
- q2leg.pcx
- q2bike.pcx
- q2wheel.pcx
- q2susp1.pcx
- q2susp2.pcx
- q2forarm.pcx
- q2up_arm.pcx
- q2head.pcx
- qflag.pcx
- qkiller.pcx
- qexit.pcx
- qframe.pcx
- qcolors.pcx
- qgrass.pcx
Special filenames included in Pictures.lst
These items are handled specially in elastomania, but must be included in Pictures.lst. While they theoretically have properties such as distance etc., these properties are ignored during lgr loading. Transparency is hardcoded to be the topleft pixel for these files.
- qup_*.pcx, where * is any text
- qdown_*.pcx, where * is any text
- qfoodX.pcx, where X is 1-9
Palette
Palette must be limited to 256 colors. The palette is taken from q1bike.pcx
Mandatory Pcx files for valid .LGR
- q1body.pcx
- q1thigh.pcx
- q1leg.pcx
- q1bike.pcx
- q1wheel.pcx
- q1susp1.pcx
- q1susp2.pcx
- q1forarm.pcx
- q1up_arm.pcx
- q1head.pcx
- q2body.pcx
- q2thigh.pcx
- q2leg.pcx
- q2bike.pcx
- q2wheel.pcx
- q2susp1.pcx
- q2susp2.pcx
- q2forarm.pcx
- q2up_arm.pcx
- q2head.pcx
- qflag.pcx
- qkiller.pcx
- qexit.pcx
- qframe.pcx
- qcolors.pcx
- qfood1.pcx
LGR limits
These are the hard-coded limits to LGR files:
Pcx Files
- There must be 10-3500 Pcx Objects
- The raw contents of each .pcx file must be between 1-10,000,000 bytes in length
- The maximum filename length is 8 characters, excluding ".pcx"
- The filename must end in ".pcx" (or ".spr")
Pictures
- The maximum number of pictures is 999
- The maximum picture width is 6000 (does not apply to masks/textures)
- The maximum picture size (width*height) is 600,000 (e.g. 775*775 is too large) (does not apply to masks/textures) -> further testing reveals that some pictures can be slightly larger than 600,000, but some cannot. I'm not sure what exactly is being counted to 600,000, but all I know is that below 600,000 is for sure safe, whereas most pictures crash above 600,000. Increased zoom will also increase picture size, meaning that if you have very large images in your lgr file, it may not be compatible with increased zoom.
- There may be no duplicate picture names
Textures
- There must be 2-99 textures.
- qgrass.pcx counts as a texture (it is included in the 2-99 limit)
- There may be no duplicate texture names
Masks
- The maximum number of masks is 199
- There exists a "mask is too complicated" error. An example of a mask that is too complicated is a mask alternating every pixel as solid/transparent/solid/transparent of medium size. Increased zoom can also make otherwise acceptable masks throw this error.
- There may be no duplicate mask names
Grass
- The maximum number of QUP_* and QDOWN_* .pcx files is 99.
Bike/kuski .pcx files
The following .pcx files are limited to a width of 255 and a height of 255. I think they are all stretched as described in Big_Book_of_Elma_Facts#LGR_tricks.2C_Part_1.
- q1body.pcx
- q1thigh.pcx
- q1leg.pcx
- q1wheel.pcx
- q1susp1.pcx
- q1susp2.pcx
- q1forarm.pcx
- q1up_arm.pcx
- q1head.pcx
- q2body.pcx
- q2thigh.pcx
- q2leg.pcx
- q2wheel.pcx
- q2susp1.pcx
- q2susp2.pcx
- q2forarm.pcx
- q2up_arm.pcx
- q2head.pcx
- qflag.pcx
Q1bike.pcx and q2bike.pcx are handled specially: Big_Book_of_Elma_Facts#LGR_tricks.2C_Part_1. If the bike image is too small, the bike will simply be invisible or black, but no error will occur.
Object .pcx files
This pertains to qkiller.pcx, qexit.pcx and qfood*.pcx:
- The width of any object file must be a multiple of 40, as each 40 pixels are used as 1 frame of animation
- The maximum number of frames is 1000 (however, I think the .pcx file format breaks down before reaching a width of 40,000)
- If the height of the .pcx file is greater than 40, all the rows past the 40th are ignored and not drawn
- If the height of the .pcx file is less than 40, the missing rows will be read as garbled data, usually leading to a crash
- Qfood*.pcx must be entered in order. If a number is missing, no more files will be loaded. (e.g. if qfood 1, 2, and 5 exist, only 1 and 2 will be loaded)
QGRASS.pcx
Qgrass.pcx is added as a hidden texture. It can be used just like any other texture - with masks, or as a ground/sky background image.
getatlatszosag Internal Error
If you have an empty "message.inf" file in your main Elma directory, if you try to open an lgr and get the error message: "getatlatszosag", then the error is caused from a glitch in EasyLGR.exe. When importing images, sometimes the "Background pixel:" option in newly-added images is not set to anything. To fix the bug, make sure all new images have a background pixel option set, even if it is "None"