Add corner blocks

This commit is contained in:
Miloslav Ciz 2024-10-01 22:38:49 +02:00
parent fa22cf0e9c
commit 7d7830073a
3 changed files with 39 additions and 2 deletions

View file

@ -47,6 +47,8 @@ LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,2,1,0,0),
LCR_MAP_BLOCK(LCR_BLOCK_LEFT,9,0,20,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,8,1,8,0,0),
LCR_MAP_BLOCK(LCR_BLOCK_CORNER_12,3,1,5,0,0),
/*
LCR_MAP_BLOCK(LCR_BLOCK_FULL,15,0,0,LCR_BLOCK_MATERIAL_GRASS,0),
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,15,0,0),
@ -64,7 +66,6 @@ LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,15,0,0),
#define LCR_IMAGE_SIZE 64 ///< one-dimension resolution of bitmap image
#define LCR_IMAGE_STORE_SIZE (LCR_IMAGE_SIZE * LCR_IMAGE_SIZE + 256 * 2)
struct
{
uint16_t palette[256];

21
map.h
View file

@ -83,7 +83,9 @@
#define LCR_BLOCK_RAMP_CURVED 0x09
#define LCR_BLOCK_RAMP_CURVED_SHORT 0x0a
#define LCR_BLOCK_RAMP_CURVED_WALL 0x0b
#define LCR_BLOCK_RAMP_STEEP 0x0c
#define LCR_BLOCK_RAMP_STEEP 0x0c ///< extremely steep ramp
#define LCR_BLOCK_CORNER 0x0d ///< diagonal corner
#define LCR_BLOCK_CORNER_12 0x0e ///< diagonal corner (1/2 wide)
#define LCR_BLOCK_FULL_ACCEL 0x20
#define LCR_BLOCK_FULL_FAN 0x30
@ -600,6 +602,23 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
break;
}
case LCR_BLOCK_CORNER:
case LCR_BLOCK_CORNER_12:
{
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(0,4,6) ADD(0,0,6) // left
ADD(0,0,0) ADD(0,4,0) ADD(0,4,6) // left
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,0) ADD(right,4,6) ADD(0,4,6) // top
ADD(0,0,6) ADD(right,0,6) ADD(0,0,0) // bottom
break;
}
default: break;
}

View file

@ -154,6 +154,23 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
break;
}
case LCR_BLOCK_CORNER:
case LCR_BLOCK_CORNER_12:
{
TPE_Unit sides[6];
sides[0] = -1 * LCR_PHYSICS_UNIT / 2;
sides[1] = LCR_PHYSICS_UNIT / 2;
sides[2] = -1 * LCR_PHYSICS_UNIT / 2;
sides[3] = -1 * LCR_PHYSICS_UNIT / 2;
sides[4] = block[0] == LCR_BLOCK_CORNER ? LCR_PHYSICS_UNIT / 2 : 0;
sides[5] = LCR_PHYSICS_UNIT / 2;
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,
LCR_PHYSICS_UNIT / 2,1);
break;
}
default:
point = TPE_vec3(0,0,LCR_MAP_SIZE_BLOCKS * LCR_PHYSICS_UNIT);
break;