47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
#ifndef _LCR_MAP
|
|
#define _LCR_MAP
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
The map (track) module for Licar.
|
|
|
|
Map format is binary and consists of following values:
|
|
|
|
- 76, 77 (for "LM", magic number)
|
|
- ASCII map name
|
|
- 10 (separator)
|
|
- ASCII comment
|
|
- 10 (separator)
|
|
- block values, each one in the format:
|
|
- 1 byte type: says the type of block. If the highest bit is 0, the block is
|
|
normal, otherwise it is a special block (e.g. a "command")
|
|
- 3 bytes: A, B, C, such that:
|
|
- A, B and lowest 2 bits of C form the block coordinate number (A being
|
|
the lowest part etc.), a sequential number going from 0,0,0 in +X
|
|
direction, then +Y and then +Z.
|
|
- bits C2 and C3 say the block material
|
|
- highest 4 bits of C (C4, C5, C6, C7) say the block's transform:
|
|
- first if C4 is set, the block is flipped in the X direction
|
|
- then the block is rotated around vertical axis by 0, 90, 180 or 270
|
|
degrees if C5C6 is 00, 01, 10 or 11.
|
|
- last if C7 is set, the block is flipped vertically
|
|
- 255 (terminator)
|
|
*/
|
|
|
|
#define LCR_BLOCK_TRANSFORM_ROT_MASK 0x60
|
|
|
|
#define LCR_BLOCK_TRANSFORM_FLIP_H 0x10
|
|
#define LCR_BLOCK_TRANSFORM_ROT_90 0x20
|
|
#define LCR_BLOCK_TRANSFORM_ROT_180 0x40
|
|
#define LCR_BLOCK_TRANSFORM_ROT_270 0x60
|
|
#define LCR_BLOCK_TRANSFORM_FLIP_V 0x80
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t type; ///< block type
|
|
uint8_t coordMatTrans[3]; ///< coordinate, material and transform
|
|
} LCR_MapBlock;
|
|
|
|
#endif // guard
|