Add curved ramp

This commit is contained in:
Miloslav Ciz 2024-10-03 00:24:28 +02:00
parent 7d7830073a
commit 9f112e5869
3 changed files with 76 additions and 23 deletions

51
map.h
View file

@ -80,13 +80,22 @@
#define LCR_BLOCK_RAMP_34 0x06 ///< plain ramp, 3/4 size
#define LCR_BLOCK_RAMP_12 0x07 ///< plain ramp, 1/2 size
#define LCR_BLOCK_RAMP_14 0x08 ///< plain ramp, 1/4 size
#define LCR_BLOCK_RAMP_CURVED 0x09
#define LCR_BLOCK_RAMP_CURVED_SHORT 0x0a
#define LCR_BLOCK_RAMP_CURVED_WALL 0x0b
#define LCR_BLOCK_RAMP_CURVED_PLAT 0x09 ///< curved ramp with top platgform
#define LCR_BLOCK_RAMP_CURVED 0x0a ///< curv. ramp without top platf.
#define LCR_BLOCK_RAMP_CURVED_WALL 0x0b ///< curved ramp plus small wall
#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)
/*
TODO:
- ramp corner???
- curved corner?
- curved out corner?
- curved "hill"
- bumpy road
*/
#define LCR_BLOCK_FULL_ACCEL 0x20
#define LCR_BLOCK_FULL_FAN 0x30
@ -188,8 +197,10 @@ 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,
/**
Gets dimensions of a non-curved ramp.
*/
void LCR_rampGetDimensions(uint8_t rampType, uint8_t *height4ths,
uint8_t *length6ths)
{
*height4ths =
@ -201,17 +212,6 @@ void LCR_rampGetDimensions(uint8_t rampType,
*length6ths = rampType != LCR_BLOCK_RAMP_STEEP ? 6 : 1;
}
/*
int LCR_rampHeight4ths(uint8_t rampType)
{
return
(rampType == LCR_BLOCK_RAMP_14) +
(rampType == LCR_BLOCK_RAMP) * 4 +
(rampType == LCR_BLOCK_RAMP_12 || rampType == LCR_BLOCK_RAMP_34) * 2 +
(rampType == LCR_BLOCK_RAMP_34);
}
*/
uint8_t *LCR_getMapBlockAtCoordNumber(uint32_t coord)
{
// binary search the block:
@ -552,6 +552,25 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
break;
}
case LCR_BLOCK_RAMP_CURVED:
ADD(0,0,0) ADD(6,0,0) ADD(0,1,4) // ramp
ADD(0,1,4) ADD(6,0,0) ADD(6,1,4)
ADD(0,1,4) ADD(6,1,4) ADD(0,2,5) // ramp
ADD(0,2,5) ADD(6,1,4) ADD(6,2,5)
ADD(0,2,5) ADD(6,2,5) ADD(0,4,6) // ramp
ADD(0,4,6) ADD(6,2,5) ADD(6,4,6)
ADD(0,0,0) ADD(0,1,4) ADD(0,0,6) // left
ADD(0,0,6) ADD(0,1,4) ADD(0,2,5)
ADD(0,0,6) ADD(0,2,5) ADD(0,4,6)
ADD(6,0,0) ADD(6,0,6) ADD(6,1,4) // right
ADD(6,0,6) ADD(6,2,5) ADD(6,1,4)
ADD(6,0,6) ADD(6,4,6) ADD(6,2,5)
ADD(0,0,6) ADD(0,4,6) ADD(6,0,6) // back
ADD(6,0,6) ADD(0,4,6) ADD(6,4,6)
ADD(0,0,0) ADD(6,0,6) ADD(6,0,0) // bottom
ADD(0,0,0) ADD(0,0,6) ADD(6,0,6)
break;
case LCR_BLOCK_RAMP_CURVED_WALL:
ADD(0,0,0) ADD(5,0,0) ADD(0,1,3) // ramp
ADD(0,1,3) ADD(5,0,0) ADD(5,1,3)