Add more accels and fans
This commit is contained in:
parent
7c3eac7d9f
commit
5d9038021a
5 changed files with 42 additions and 72 deletions
44
map.h
44
map.h
|
@ -103,10 +103,15 @@
|
|||
#define LCR_BLOCK_CORNER 'A' ///< diagonal corner
|
||||
#define LCR_BLOCK_CORNER_12 '\\' ///< diagonal corner (1/2 wide)
|
||||
#define LCR_BLOCK_HILL '(' ///< curved "hill"
|
||||
#define LCR_BLOCK_FULL_ACCEL '>'
|
||||
#define LCR_BLOCK_FULL_FAN 'o'
|
||||
#define LCR_BLOCK_BUMP '~' ///< small bump on the road
|
||||
|
||||
#define LCR_BLOCK_FULL_ACCEL '>'
|
||||
#define LCR_BLOCK_BOTTOM_ACCEL 'z'
|
||||
#define LCR_BLOCK_RAMP_ACCEL 'y'
|
||||
|
||||
#define LCR_BLOCK_FULL_FAN 'o'
|
||||
#define LCR_BLOCK_RAMP_FAN 'V'
|
||||
|
||||
#define LCR_BLOCK_CORNER_CONVEX 'n'
|
||||
#define LCR_BLOCK_CORNER_CONCAVE 'l'
|
||||
|
||||
|
@ -188,6 +193,17 @@ uint8_t LCR_mapBlockOppositeTransform(uint8_t transform)
|
|||
return transform;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsAccelerator(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_ACCEL || block == LCR_BLOCK_RAMP_ACCEL ||
|
||||
block == LCR_BLOCK_BOTTOM_ACCEL;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsFan(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_FAN || block == LCR_BLOCK_RAMP_FAN;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockGetTransform(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
{
|
||||
return block[3] & 0xf0;
|
||||
|
@ -195,7 +211,9 @@ uint8_t LCR_mapBlockGetTransform(const uint8_t block[LCR_BLOCK_SIZE])
|
|||
|
||||
uint8_t LCR_mapBlockGetMaterial(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
{
|
||||
return (block[3] >> 2) & 0x03;
|
||||
return (LCR_mapBlockIsAccelerator(block[0]) ||
|
||||
LCR_mapBlockIsFan(block[0])) ? LCR_BLOCK_MATERIAL_CONCRETE :
|
||||
((block[3] >> 2) & 0x03);
|
||||
}
|
||||
|
||||
uint32_t LCR_mapBlockGetCoordNumber(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
|
@ -219,7 +237,8 @@ void LCR_rampGetDimensions(uint8_t rampType, uint8_t *height4ths,
|
|||
{
|
||||
*height4ths =
|
||||
(rampType == LCR_BLOCK_RAMP_14) +
|
||||
(rampType == LCR_BLOCK_RAMP || rampType == LCR_BLOCK_RAMP_STEEP) * 4 +
|
||||
(rampType == LCR_BLOCK_RAMP || rampType == LCR_BLOCK_RAMP_ACCEL ||
|
||||
rampType == LCR_BLOCK_RAMP_FAN || rampType == LCR_BLOCK_RAMP_STEEP) * 4 +
|
||||
(rampType == LCR_BLOCK_RAMP_12 || rampType == LCR_BLOCK_RAMP_34) * 2 +
|
||||
(rampType == LCR_BLOCK_RAMP_34);
|
||||
|
||||
|
@ -619,16 +638,6 @@ void _LCR_addBlockShapeByte(uint8_t *bytes, uint8_t *byteCount,
|
|||
*byteCount += 1;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsAccelerator(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_ACCEL;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsFan(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_FAN;
|
||||
}
|
||||
|
||||
/**
|
||||
Macro that transforms coordinates according to block transformation.
|
||||
*/
|
||||
|
@ -691,11 +700,14 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
|||
case LCR_BLOCK_BOTTOM_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_LEFT ||
|
||||
if (blockType == LCR_BLOCK_BOTTOM ||
|
||||
blockType == LCR_BLOCK_BOTTOM_ACCEL ||
|
||||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
yTop /= 2;
|
||||
|
||||
|
@ -783,6 +795,8 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
|||
case LCR_BLOCK_RAMP_14:
|
||||
case LCR_BLOCK_RAMP_34:
|
||||
case LCR_BLOCK_RAMP_STEEP:
|
||||
case LCR_BLOCK_RAMP_ACCEL:
|
||||
case LCR_BLOCK_RAMP_FAN:
|
||||
{
|
||||
uint8_t front, top;
|
||||
LCR_rampGetDimensions(blockType,&top,&front);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue