Additional information can be found at LGR/Technical
LGRs are the graphics packs that determines the look of Elma. No one knows exactly what the acronym "LGR" stands for. Maybe it's "Level GRaphics" or "Level Graphics Resources".
An LGR file contains pictures, both for objects like the bike and exit, but also purely decorative ones like the trees in the default LGR. There are also textures and masks in the LGR. A mask determines the area to apply a texture to.
When you design a level, you can use the level properties settings to set which LGR to use. If the designated LGR is missing, the default lgr will be used instead. You can select LGRs more permanently by replacing the original Default.lgr with another LGR file renamed to default.lgr.
LGR Development Kit
The LGR DK is a collection of programs and other components that you can use to create your own LGRs.
The make_lgr.exe program
Make_lgr.exe is a command line program that gathers pcx files and builds an LGR file that can be used in Elma. To let the make_lgr.exe file know what pcx files it should put into the LGR file, you must list the names of the pcx files and some other information in a file called pictures.lst.
There are some pcx files that the LGR file must contain. For example the LGR file must contain the pictures of the bike, the legs and hands of the biker, pictures of the apple and some other pictures. In the pictures.lst file you only need to list the names of the picture files you want to add on your own.
Before you can build an LGR file with the make_lgr.exe program, you have to put all pcx files in a directory with the pictures.lst file. The pcx files should be in 8-bit mode with a common global palette. (The LGR DK also contains tools about converting true color images into 8 bit common palette pcx files.)
The pictures.lst file
In the pictures.lst file every line contains description about one pcx file. The first part of the line is the name without the extension. The next part of the line is the type of the picture that can be, PICT, TEXT or MASK.
If the type is PICT, the image will be a normal picture with the top-left pixel as the transparent color. If the type is TEXT, it is a texture, and if the type is MASK, it is a mask (masks and textures can only be used together). If the type is not MASK you also have to give a default distance and clipping property.
The distance must be in the range 1-999, while the clipping property must be either 'U', 'S', or 'G'. The biker and the food, exit and killer objects have a distance of 500.
The clipping property determines whether a picture is seen above the sky, the ground, or both. (This is independent of the distances.) So 'U' (Unclipped) means that the picture or texture will be seen above everything in the level (unless other pictures hide it). 'S' (Sky) means the picture will be seen only on top of the sky. 'G' (Ground) means the picture will only be seen on top of the ground.
Those pictures that are required for the LGR file are beginning with the letter Q. In this way you can find these files easily in an alphabetical list. You need to have all of these pcx files to be able to build an LGR file.
The apple, killer and flower objects are animations. In the LGR file they are represented by single pictures that contain all the frames of one animation. The QEXIT.PCX file is for example 50 copies of 40x40 pixels frames put together horizontally making one 2000x40 pixels image. It is up to you how many frames you put into an animation picture, but it must be 40 pixels tall and 40*N pixels wide. If you set the 'Animated Objects' off in the options menu in Elma, the first frame will be visible all the time instead of the animation.
There is one animation for the flower object and one for the killer object in an LGR file (QEXIT.PCX and QKILLER.PCX). But there may be multiple apple animations. You must add at least one apple animation to the LGR file, the QFOOD1.PCX picture, but optionally you can add a QFOOD2.PCX, ..., QFOOD9.PCX picture into your LGR file too if you want.
The game will stop loading the sequence of these pictures if one is missing (so if you have QFOOD1,2,3,4 and 6, only the first 4 will be loaded).
If you set the 'Food anim number' property of an apple object (by right clicking on it in the level editor) to 5 for example, the game will try to play the animation from the QFOOD5.PCX picture for this object. If this picture is not loaded, it will be substituted. You need to list the names of these food objects in pictures.lst (but not the exit and killer objects).
When the program displays grass on a level, it builds it up from a texture that is stored in QGRASS.PCX, and from little grass pictures that makes the lower border of the grass. The names of these little border pictures are in the form of QUP_*.PCX and QDOWN_*.PCX. That means QUP_AA.PCX for example will be a grass picture automatically, but you need to list it in the pictures.lst file along with the QGRASS.PCX picture. (It doesn't matter what properties you give to these pictures.) If the picture is an 'UP' picture, the grass should be higher on the right side of the picture than on the left (the opposite for the 'DOWN').
If you do not list the QGRASS.PCX picture and at least two QUP_*.PCX or QDOWN_*.PCX pictures in the pictures.lst file, there will be no grass on the levels you play with this lgr file.
Default Sky and ground textures
If there is a SKY.PCX texture in an lgr file, it will be the default Sky. Similarly if there is a GROUND.PCX texture in an lgr file, it will be the default ground.
The LGRLIST.TXT file
If you don't want to replace the original default lgr file for all levels, just create an lgrlist.txt file:
Let's say you make your own file, called myfile.lgr, and you copy it to the Lgr subdirectory. Also, you create a file in the lgr subdirectory called lgrlist.txt, which has the following lines:
- 5 myfile.lgr
- 6 myfile.lgr
- 8 myfile.lgr
In this case if you play on internal level 5, 6 and 8, your lgr file will be loaded.
Converting truecolor to 8-bit color
You can work with 8-bit color images in your paint program. But you may want to work with truecolor pictures in your paint program and then convert your pictures to 8-bit colors before building the LGR file.
To do this you can use the two programs included in the LGR DK, MERGEPIC.EXE and APARTPIC.EXE.
The MERGEPIC.EXE program takes the small truecolor Targa (.TGA) images from the current directory and creates a big picture named TMP.TGA which will contain the small Targa images. You have to convert this big truecolor image to an indexed colored image on your own (most paint programs can do this).
The APARTPIC.EXE takes the big TMP.PCX image and divides it into small PCX images.
These programs get the list of the image files they must manipulate in the same way as MAKE_LGR.EXE. They process the images listed in the pictures.lst file and in addition all fixed named images.
The two programs won't process the MASK images however (in the pictures.lst file they are listed as MASK). These pictures are used only for masking shapes in the game and it doesn't matter what color palette they have. So you can convert them individually to indexed colors (they need to have exactly 256 colors in their palette however).
Important: Turn off dithering when converting the TMP.TGA image to the TMP.PCX image.