Add steep ramp

This commit is contained in:
Miloslav Ciz 2024-10-01 22:08:03 +02:00
parent 4a3c9b2873
commit fa22cf0e9c
3 changed files with 43 additions and 18 deletions

37
map.h
View file

@ -83,6 +83,7 @@
#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_FULL_ACCEL 0x20
#define LCR_BLOCK_FULL_FAN 0x30
@ -185,6 +186,20 @@ uint32_t LCR_mapBlockCoordsToCoordNumber(uint8_t x, uint8_t y, uint8_t z)
return LCR_mapBlockGetCoordNumber(b);
}
void LCR_rampGetDimensions(uint8_t rampType,
uint8_t *height4ths,
uint8_t *length6ths)
{
*height4ths =
(rampType == LCR_BLOCK_RAMP_14) +
(rampType == LCR_BLOCK_RAMP || rampType == LCR_BLOCK_RAMP_STEEP) * 4 +
(rampType == LCR_BLOCK_RAMP_12 || rampType == LCR_BLOCK_RAMP_34) * 2 +
(rampType == LCR_BLOCK_RAMP_34);
*length6ths = rampType != LCR_BLOCK_RAMP_STEEP ? 6 : 1;
}
/*
int LCR_rampHeight4ths(uint8_t rampType)
{
return
@ -193,6 +208,7 @@ int LCR_rampHeight4ths(uint8_t rampType)
(rampType == LCR_BLOCK_RAMP_12 || rampType == LCR_BLOCK_RAMP_34) * 2 +
(rampType == LCR_BLOCK_RAMP_34);
}
*/
uint8_t *LCR_getMapBlockAtCoordNumber(uint32_t coord)
{
@ -566,17 +582,20 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
case LCR_BLOCK_RAMP_12:
case LCR_BLOCK_RAMP_14:
case LCR_BLOCK_RAMP_34:
case LCR_BLOCK_RAMP_STEEP:
{
uint8_t top = LCR_rampHeight4ths(blockType);
uint8_t front, top;
LCR_rampGetDimensions(blockType,&top,&front);
front = 6 - front;
ADD(0,0,0) ADD(0,top,6) ADD(0,0,6) // side
ADD(6,0,0) ADD(6,0,6) ADD(6,top,6) // side
ADD(0,0,0) ADD(6,0,0) ADD(0,top,6) // top
ADD(6,0,0) ADD(6,top,6) ADD(0,top,6) // top
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,0) ADD(0,0,6) ADD(6,0,6) // bottom
ADD(0,0,0) ADD(6,0,6) ADD(6,0,0) // bottom
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(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(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,front) ADD(0,0,6) ADD(6,0,6) // bottom
ADD(0,0,front) ADD(6,0,6) ADD(6,0,front) // bottom
break;
}