Add blocks

This commit is contained in:
Miloslav Ciz 2025-01-29 15:01:11 +01:00
parent 6986028e33
commit be11c582b1
4 changed files with 73 additions and 27 deletions

67
map.h
View file

@ -89,11 +89,13 @@
#define LCR_BLOCK_BOTTOM '-' ///< filled bottom half
#define LCR_BLOCK_LEFT ';' ///< filled left half
#define LCR_BLOCK_BOTTOM_LEFT ',' ///< filled bottom left quarter
#define LCR_BLOCK_BOTTOM_LEFT_FRONT '.' ///< filled bottom left front eigth
#define LCR_BLOCK_BOTTOM_LEFT_FRONT '.' ///< filled bottom left front eighth
#define LCR_BLOCK_LEFT_FRONT 'I' ///< filled left front quarter
#define LCR_BLOCK_RAMP '^' ///< plain ramp
#define LCR_BLOCK_RAMP_34 '/' ///< plain ramp, 3/4 size
#define LCR_BLOCK_RAMP_12 '<' ///< plain ramp, 1/2 size
#define LCR_BLOCK_RAMP_14 '_' ///< plain ramp, 1/4 size
#define LCR_BLOCK_RAMP_12_UP '\'' ///< ramp, 1/2 size, elevated up
#define LCR_BLOCK_RAMP_CORNER 'v' ///< corner of a ramp
#define LCR_BLOCK_RAMP_CURVED_PLAT ']' ///< curved ramp with top platgform
#define LCR_BLOCK_RAMP_CURVED ')' ///< curv. ramp without top platf.
@ -114,7 +116,7 @@
#define LCR_BLOCK_RAMP_FAN 'V'
#define LCR_BLOCK_CHECKPOINT_0 '+' ///< checkpoint, not taken
#define LCR_BLOCK_CHECKPOINT_1 '\'' ///< checkpoint, taken
#define LCR_BLOCK_CHECKPOINT_1 '\t' ///< checkpoint, taken
#define LCR_BLOCK_FINISH '!' ///< finish
@ -701,23 +703,27 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
case LCR_BLOCK_LEFT:
case LCR_BLOCK_BOTTOM_LEFT:
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
case LCR_BLOCK_LEFT_FRONT:
case LCR_BLOCK_FULL_ACCEL:
case LCR_BLOCK_FULL_FAN:
case LCR_BLOCK_BOTTOM_ACCEL:
{
uint8_t xRight = 6, yTop = 4,
zBack = 6 >> (blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT);
if (blockType == LCR_BLOCK_BOTTOM ||
blockType == LCR_BLOCK_BOTTOM_ACCEL ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
yTop /= 2;
if (blockType == LCR_BLOCK_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
xRight /= 2;
uint8_t
xRight = 6 >>
(blockType == LCR_BLOCK_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
blockType == LCR_BLOCK_LEFT_FRONT),
yTop = 4 >>
(blockType == LCR_BLOCK_BOTTOM ||
blockType == LCR_BLOCK_BOTTOM_ACCEL ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT),
zBack = 6 >>
(blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
blockType == LCR_BLOCK_LEFT_FRONT);
ADD(0,0,0) ADD(xRight,0,0) ADD(xRight,yTop,0) // front
ADD(0,0,0) ADD(xRight,yTop,0) ADD(0,yTop,0)
@ -793,6 +799,21 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
ADD(0,0,0) ADD(0,0,6) ADD(6,0,6)
break;
case LCR_BLOCK_RAMP_12_UP:
ADD(0,2,0) ADD(0,4,6) ADD(0,0,6) // side
ADD(0,0,0) ADD(0,2,0) ADD(0,0,6)
ADD(6,2,0) ADD(6,0,6) ADD(6,4,6) // side
ADD(6,0,0) ADD(6,0,6) ADD(6,2,0)
ADD(0,2,0) ADD(6,2,0) ADD(0,4,6) // top
ADD(6,2,0) ADD(6,4,6) ADD(0,4,6)
ADD(0,0,6) ADD(6,4,6) ADD(6,0,6) // back
ADD(0,0,6) ADD(0,4,6) ADD(6,4,6)
ADD(0,0,0) ADD(6,0,0) ADD(6,2,0) // front
ADD(0,0,0) ADD(6,2,0) ADD(0,2,0)
ADD(0,0,0) ADD(0,0,6) ADD(6,0,6) // bottom
ADD(0,0,0) ADD(6,0,6) ADD(6,0,0)
break;
case LCR_BLOCK_RAMP:
case LCR_BLOCK_RAMP_12:
case LCR_BLOCK_RAMP_14:
@ -806,13 +827,13 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
front = 6 - front;
ADD(0,0,front) ADD(0,top,6) ADD(0,0,6) // side
ADD(6,0,front) ADD(6,0,6) ADD(6,top,6) // side
ADD(6,0,front) ADD(6,0,6) ADD(6,top,6)
ADD(0,0,front) ADD(6,0,front) ADD(0,top,6) // top
ADD(6,0,front) ADD(6,top,6) ADD(0,top,6) // top
ADD(6,0,front) ADD(6,top,6) ADD(0,top,6)
ADD(0,0,6) ADD(6,top,6) ADD(6,0,6) // back
ADD(0,0,6) ADD(0,top,6) ADD(6,top,6) // back
ADD(0,0,6) ADD(0,top,6) ADD(6,top,6)
ADD(0,0,front) ADD(0,0,6) ADD(6,0,6) // bottom
ADD(0,0,front) ADD(6,0,6) ADD(6,0,front) // bottom
ADD(0,0,front) ADD(6,0,6) ADD(6,0,front)
break;
}
@ -823,11 +844,11 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
uint8_t right = blockType == LCR_BLOCK_CORNER ? 6 : 3;
ADD(0,0,0) ADD(right,0,6) ADD(right,4,6) // front/right
ADD(0,0,0) ADD(right,4,6) ADD(0,4,0) // front/right
ADD(0,0,0) ADD(right,4,6) ADD(0,4,0)
ADD(0,0,0) ADD(0,4,6) ADD(0,0,6) // left
ADD(0,0,0) ADD(0,4,0) ADD(0,4,6) // left
ADD(0,0,0) ADD(0,4,0) ADD(0,4,6)
ADD(right,0,6) ADD(0,0,6) ADD(0,4,6) // back
ADD(0,4,6) ADD(right,4,6) ADD(right,0,6) // back
ADD(0,4,6) ADD(right,4,6) ADD(right,0,6)
ADD(0,4,0) ADD(right,4,6) ADD(0,4,6) // top
ADD(0,0,6) ADD(right,0,6) ADD(0,0,0) // bottom
@ -903,7 +924,7 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
{
for (int i = 0; i < *byteCount; ++i)
{
uint8_t x, y, z, tmp;
uint8_t x, y, z;
_LCR_decodeMapBlockCoords(bytes[i],&x,&y,&z);