Add steep ramp
This commit is contained in:
parent
4a3c9b2873
commit
fa22cf0e9c
3 changed files with 43 additions and 18 deletions
13
assets.h
13
assets.h
|
@ -35,17 +35,19 @@ LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,15,1,0,0),
|
|||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,0,1,19,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,8,1,1,0,0),
|
||||
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,8,1,5,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_270),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_STEEP,8,1,5,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_270),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,1,1,8,0,0),
|
||||
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_STEEP,8,2,5,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_270 | LCR_BLOCK_TRANSFORM_FLIP_V),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,1,1,8,0,0),
|
||||
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_LEFT,5,1,5,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90),
|
||||
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_FULL,15,0,0,LCR_BLOCK_MATERIAL_GRASS,0),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,15,0,0),
|
||||
|
||||
|
@ -54,10 +56,7 @@ LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,15,0,0),
|
|||
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,35,0,0,LCR_BLOCK_MATERIAL_DIRT,0),
|
||||
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,15,0,0),
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
LCR_MAP_TERMINATOR
|
||||
};
|
||||
|
|
33
map.h
33
map.h
|
@ -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,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,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,0,6) ADD(6,0,6) // bottom
|
||||
ADD(0,0,front) ADD(6,0,6) ADD(6,0,front) // bottom
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
11
racing.h
11
racing.h
|
@ -131,9 +131,16 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
case LCR_BLOCK_RAMP_34:
|
||||
case LCR_BLOCK_RAMP_12:
|
||||
case LCR_BLOCK_RAMP_14:
|
||||
case LCR_BLOCK_RAMP_STEEP:
|
||||
{
|
||||
uint8_t front, top;
|
||||
LCR_rampGetDimensions(block[0],&top,&front);
|
||||
front = 6 - front;
|
||||
|
||||
TPE_Unit sides[6];
|
||||
sides[0] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[0] =
|
||||
-1 * LCR_PHYSICS_UNIT / 2 + (LCR_PHYSICS_UNIT / 6) * ((int) front);
|
||||
|
||||
sides[1] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
|
||||
sides[2] = LCR_PHYSICS_UNIT / 2;
|
||||
|
@ -141,7 +148,7 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
|
||||
sides[4] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[5] = -1 * LCR_PHYSICS_UNIT / 4 +
|
||||
LCR_rampHeight4ths(block[0]) * (LCR_PHYSICS_UNIT / 8);
|
||||
((int) top) * (LCR_PHYSICS_UNIT / 8);
|
||||
|
||||
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT,2);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue