Add hill block
This commit is contained in:
parent
1c83fe4660
commit
21cedabf85
3 changed files with 59 additions and 6 deletions
7
assets.h
7
assets.h
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
static const char *LCR_maps[] =
|
static const char *LCR_maps[] =
|
||||||
{
|
{
|
||||||
"LM;;;0; #=s0s0 #}r0s0-|L #*r0c0 "
|
"LM;;;0;#*s1s0"
|
||||||
|
"#=s0s0 #fd190"
|
||||||
|
"#=C0s1 #fd190"
|
||||||
|
"#=M0s2 #fd190"
|
||||||
|
"#=W0s3 #fd190"
|
||||||
|
"#(s0r0"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LCR_IMAGE_SIZE 64 ///< one-dimension resolution of bitmap image
|
#define LCR_IMAGE_SIZE 64 ///< one-dimension resolution of bitmap image
|
||||||
|
|
40
map.h
40
map.h
|
@ -103,11 +103,15 @@
|
||||||
#define LCR_BLOCK_RAMP_STEEP 0x0c ///< extremely steep ramp
|
#define LCR_BLOCK_RAMP_STEEP 0x0c ///< extremely steep ramp
|
||||||
#define LCR_BLOCK_CORNER 0x0d ///< diagonal corner
|
#define LCR_BLOCK_CORNER 0x0d ///< diagonal corner
|
||||||
#define LCR_BLOCK_CORNER_12 0x0e ///< diagonal corner (1/2 wide)
|
#define LCR_BLOCK_CORNER_12 0x0e ///< diagonal corner (1/2 wide)
|
||||||
|
#define LCR_BLOCK_HILL 0x0f ///< curved "hill"
|
||||||
#define LCR_BLOCK_FULL_ACCEL 0x20
|
#define LCR_BLOCK_FULL_ACCEL 0x20
|
||||||
#define LCR_BLOCK_FULL_FAN 0x30
|
#define LCR_BLOCK_FULL_FAN 0x30
|
||||||
#define LCR_BLOCK_CHECKPOINT_0 0x40 ///< checkpoint, not taken
|
#define LCR_BLOCK_CHECKPOINT_0 0x40 ///< checkpoint, not taken
|
||||||
#define LCR_BLOCK_CHECKPOINT_1 0x41 ///< checkpoint, taken
|
#define LCR_BLOCK_CHECKPOINT_1 0x41 ///< checkpoint, taken
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LCR_BLOCK_FINISH 0x42 ///< finish
|
#define LCR_BLOCK_FINISH 0x42 ///< finish
|
||||||
|
|
||||||
// special blocks:
|
// special blocks:
|
||||||
|
@ -129,8 +133,6 @@
|
||||||
- bumpy road
|
- bumpy road
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LCR_MAP_BLOCK_CACHE_SIZE (8 * 2) /// do not change
|
#define LCR_MAP_BLOCK_CACHE_SIZE (8 * 2) /// do not change
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,6 +346,7 @@ uint8_t _LCR_mapCharToBlockType(char c)
|
||||||
case '|': return LCR_BLOCK_RAMP_STEEP; break;
|
case '|': return LCR_BLOCK_RAMP_STEEP; break;
|
||||||
case 'A': return LCR_BLOCK_CORNER; break;
|
case 'A': return LCR_BLOCK_CORNER; break;
|
||||||
case '\\': return LCR_BLOCK_CORNER_12; break;
|
case '\\': return LCR_BLOCK_CORNER_12; break;
|
||||||
|
case '(': return LCR_BLOCK_HILL; break;
|
||||||
case '>': return LCR_BLOCK_FULL_ACCEL; break;
|
case '>': return LCR_BLOCK_FULL_ACCEL; break;
|
||||||
case 'o': return LCR_BLOCK_FULL_FAN; break;
|
case 'o': return LCR_BLOCK_FULL_FAN; break;
|
||||||
case '+': return LCR_BLOCK_CHECKPOINT_0; break;
|
case '+': return LCR_BLOCK_CHECKPOINT_0; break;
|
||||||
|
@ -505,14 +508,17 @@ uint8_t LCR_mapLoadFromStr(const char *mapStr)
|
||||||
mat = LCR_mapBlockGetMaterial(prevBlock);
|
mat = LCR_mapBlockGetMaterial(prevBlock);
|
||||||
transform = LCR_mapBlockGetTransform(prevBlock);
|
transform = LCR_mapBlockGetTransform(prevBlock);
|
||||||
LCR_mapBlockGetCoords(prevBlock,&x,&y,&z);
|
LCR_mapBlockGetCoords(prevBlock,&x,&y,&z);
|
||||||
|
|
||||||
for (uint8_t k = 0; k < coords[2]; ++k)
|
for (uint8_t k = 0; k < coords[2]; ++k)
|
||||||
for (uint8_t j = 0; j < coords[1]; ++j)
|
for (uint8_t j = 0; j < coords[1]; ++j)
|
||||||
for (uint8_t i = 0; i < coords[0]; ++i)
|
for (uint8_t i = 0; i < coords[0]; ++i)
|
||||||
if (block == LCR_BLOCK_CUBOID_FILL ||
|
if ((block == LCR_BLOCK_CUBOID_FILL ||
|
||||||
k == 0 || k == coords[2] - 1 ||
|
k == 0 || k == coords[2] - 1 ||
|
||||||
j == 0 || j == coords[1] - 1 ||
|
j == 0 || j == coords[1] - 1 ||
|
||||||
i == 0 || i == coords[0] - 1)
|
i == 0 || i == coords[0] - 1) &&
|
||||||
|
(x + i < LCR_MAP_SIZE_BLOCKS &&
|
||||||
|
y + j < LCR_MAP_SIZE_BLOCKS &&
|
||||||
|
z + k < LCR_MAP_SIZE_BLOCKS))
|
||||||
{
|
{
|
||||||
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
|
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
|
||||||
tmpBlock);
|
tmpBlock);
|
||||||
|
@ -847,6 +853,30 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LCR_BLOCK_HILL:
|
||||||
|
ADD(0,0,0) ADD(6,0,0) ADD(0,2,1) // front
|
||||||
|
ADD(6,0,0) ADD(6,2,1) ADD(0,2,1)
|
||||||
|
ADD(0,2,1) ADD(6,2,1) ADD(0,3,2) // front 2
|
||||||
|
ADD(6,2,1) ADD(6,3,2) ADD(0,3,2)
|
||||||
|
ADD(0,3,2) ADD(6,3,2) ADD(0,4,4) // front 3
|
||||||
|
ADD(6,3,2) ADD(6,4,4) ADD(0,4,4)
|
||||||
|
ADD(0,4,4) ADD(6,4,4) ADD(0,4,6) // top
|
||||||
|
ADD(6,4,4) ADD(6,4,6) ADD(0,4,6)
|
||||||
|
ADD(0,0,0) ADD(0,0,6) ADD(6,0,0) // bottom
|
||||||
|
ADD(6,0,0) ADD(0,0,6) ADD(6,0,6)
|
||||||
|
ADD(0,0,6) ADD(0,4,6) ADD(6,4,6) // back
|
||||||
|
ADD(0,0,6) ADD(6,4,6) ADD(6,0,6)
|
||||||
|
ADD(0,0,0) ADD(0,2,1) ADD(0,0,6) // left
|
||||||
|
ADD(0,2,1) ADD(0,3,2) ADD(0,0,6)
|
||||||
|
ADD(0,3,2) ADD(0,4,4) ADD(0,0,6)
|
||||||
|
ADD(0,4,4) ADD(0,4,6) ADD(0,0,6)
|
||||||
|
ADD(6,0,0) ADD(6,0,6) ADD(6,2,1) // right
|
||||||
|
ADD(6,2,1) ADD(6,0,6) ADD(6,3,2)
|
||||||
|
ADD(6,3,2) ADD(6,0,6) ADD(6,4,4)
|
||||||
|
ADD(6,4,4) ADD(6,0,6) ADD(6,4,6)
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
racing.h
18
racing.h
|
@ -227,6 +227,24 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LCR_BLOCK_HILL:
|
||||||
|
{
|
||||||
|
point =
|
||||||
|
(point.y > -1 * LCR_PHYSICS_UNIT / 4 && point.z < LCR_PHYSICS_UNIT / 4) ?
|
||||||
|
TPE_envCylinder(point,
|
||||||
|
TPE_vec3(0,-1 * LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 4),
|
||||||
|
TPE_vec3(LCR_PHYSICS_UNIT / 2,0,0),
|
||||||
|
LCR_PHYSICS_UNIT / 2 + LCR_PHYSICS_UNIT / 4) :
|
||||||
|
TPE_envAABox(point,TPE_vec3(0,0,0),
|
||||||
|
TPE_vec3(LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 4,
|
||||||
|
LCR_PHYSICS_UNIT / 2));
|
||||||
|
|
||||||
|
if (point.y < -1 * LCR_PHYSICS_UNIT / 4) // for some reason happens somet.
|
||||||
|
point.y = -1 * LCR_PHYSICS_UNIT / 4;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LCR_BLOCK_CORNER:
|
case LCR_BLOCK_CORNER:
|
||||||
case LCR_BLOCK_CORNER_12:
|
case LCR_BLOCK_CORNER_12:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue