ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

OverlayPack

From ModEnc
Revision as of 11:13, 26 May 2018 by E1 Elite (talk | contribs)
Jump to navigation Jump to search

OverlayPack and OverlayDataPack sections in TS/RA2/YR maps are packed formats which contains information of overlays used in the map. Game uses these to display the overlays like tiberium/ore or train tracks on the terrain.

OverlayPack stores the index of overlays used in the map. Index is counted from 0 as defined in [OverlayTypes] in rules(md).ini. OverlayDataPack stores the frame index of its overlay type. For example, overlay GAWALL is at overlay index 2 and it has 48 frames, so its overlaydata could take values from 0 to 47. Only a byte is used to store these data, so overlay index can be from 0 to 254 (255 is used for no overlay) and overlay frame index can be from 0 to 255 (255 can be used for frames here). Out of these, many index locations and frame numbers are hardcoded for specific logic in the game. Map editors of FinalSun and FinalAlert2 also have hardcoded restrictions, it shows only a max of 60 frames of overlay in the editor.

OverlayPack and OverlayDataPack when decoded (Base64) and decompressed (Format80/LCW), irrespective of map size, uses a fixed number of bytes to represent the data, that is 262144 bytes which is 256k. Blank OverlayPack is filled with 0xFF (255 as no overlay) while blank OverlayDataPack is filled with 0x00 (first frame by default). Only bytes (out of 0 to 262143) at locations computed by (X + (512 * Y)) are filled with data of overlay index in OverlayPack and frame index in OverlayDataPack where X and Y are cell coordinates in the map. The max map size possible using formula (mapwidth + mapheight <= 512), just fits into this 256k size.

See also IsoMapPack5