SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
MapDefinition Struct Reference

MapDefinition structure which contains data for large level background.
It's optimized to encode large map using 128x128 block chunk (block chunk are organized in metatile). More...

#include <map.h>

Public Attributes

u16 w
 
u16 h
 
u16 hp
 
u16 compression
 
u16 numMetaTile
 
u16 numBlock
 
u16metaTiles
 
void * blocks
 
void * blockIndexes
 
u16blockRowOffsets
 

Detailed Description

MapDefinition structure which contains data for large level background.
It's optimized to encode large map using 128x128 block chunk (block chunk are organized in metatile).

Parameters
wmap width in block (128x128 pixels block).
hmap height in block (128x128 pixels block).
hpmap height in block (128x128 pixels block) removing duplicated rows
compressionb0-b3=compression type for metaTiles
b4-b7=compression for blocks data
b8-b11=compression for blockIndexes data
Accepted values:
COMPRESSION_NONE
COMPRESSION_APLIB
COMPRESSION_LZ4W
numMetaTilenumber of MetaTile
numBlocknumber of Block (128x128 pixels chunk)
metaTilesmetatiles definition, each metatile is encoded as 2x2 tiles block:
  • b15: priority
  • b14-b13: palette
  • b12: vflip
  • b11: hflip
  • b10-b0: tile index (from tileset)
blocksblocks definition, each block is encoded as 8x8 metatiles:
if numMetaTile <= 256 --> 8 bit index for metaTile
else --> 16 bit index for metaTile
blockIndexesblock index array (referencing blocks) for the w * hp sized map
if numBlock <= 256 --> 8 bit index for block else --> 16 bit index for block
blockRowOffsetsblock row offsets used internally for fast retrieval of block data (index = blockIndexes[blockRowOffsets[y] + x])

The documentation for this struct was generated from the following file: