Start map chunks

This commit is contained in:
Miloslav Ciz 2024-08-06 01:34:38 +02:00
parent 22a10b6451
commit 672c17eec1
4 changed files with 224 additions and 40 deletions

21
map.h
View file

@ -83,7 +83,7 @@
#define LCR_BLOCK_RAMP_CURVED_WALL 0x09
#define LCR_BLOCK_FULL_ACCEL 0x20
#define LCR_BLOCK_FULL_STICKER 0x30
#define LCR_BLOCK_FULL_FAN 0x30
#define LCR_BLOCK_CHECKPOINT_0 0x40 ///< checkpoint, not taken
#define LCR_BLOCK_CHECKPOINT_1 0x41 ///< checkpoint, taken
@ -285,6 +285,7 @@ uint8_t LCR_mapLoad(const uint8_t *map)
switch (*map)
{
case LCR_BLOCK_CUBOID_FILL:
case LCR_BLOCK_CUBOID_HOLLOW:
{
const uint8_t *prevBlock = map - LCR_BLOCK_SIZE;
uint8_t x, y, z, w, h, d, mat, transform;
@ -301,13 +302,17 @@ uint8_t LCR_mapLoad(const uint8_t *map)
for (uint8_t k = 0; k < d; ++k)
for (uint8_t j = 0; j < h; ++j)
for (uint8_t i = 0; i < w; ++i)
{
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
tmpBlock);
if (*map == LCR_BLOCK_CUBOID_FILL ||
k == 0 || k == d - 1 ||
j == 0 || j == h - 1 ||
i == 0 || i == w - 1)
{
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
tmpBlock);
if (!_LCR_mapAddBlock(tmpBlock))
return 0;
}
if (!_LCR_mapAddBlock(tmpBlock))
return 0;
}
break;
}
@ -413,7 +418,7 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
case LCR_BLOCK_BOTTOM_LEFT:
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
case LCR_BLOCK_FULL_ACCEL:
case LCR_BLOCK_FULL_STICKER:
case LCR_BLOCK_FULL_FAN:
{
uint8_t xRight = 6, yTop = 4,
zBack = 6 >> (blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT);