Add ramp corner

This commit is contained in:
Miloslav Ciz 2024-12-11 22:53:52 +01:00
parent c145933004
commit 485b09ccbc
3 changed files with 67 additions and 3 deletions

View file

@ -24,6 +24,11 @@ static const char *LCR_maps[] =
"#=s0B0 #fd910" // concrete wall
"#^s1A0 #fk110" // ramps before wall
"#vw0m0"
"#vx0m0J"
"#vw0l0L"
"#vx0l0I"
"#-s0q0"
"#;p0w0L #f5130" // bugs

11
map.h
View file

@ -95,9 +95,7 @@
#define LCR_BLOCK_RAMP_34 '/' ///< plain ramp, 3/4 size
#define LCR_BLOCK_RAMP_12 '<' ///< plain ramp, 1/2 size
#define LCR_BLOCK_RAMP_14 '_' ///< plain ramp, 1/4 size
#define LCR_BLOCK_RAMP_CORNER ''
#define LCR_BLOCK_RAMP_CORNER 'v' ///< corner of ramp
#define LCR_BLOCK_RAMP_CURVED_PLAT ']' ///< curved ramp with top platgform
#define LCR_BLOCK_RAMP_CURVED ')' ///< curv. ramp without top platf.
@ -832,6 +830,13 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
ADD(3,0,6) ADD(3,0,0) ADD(0,0,3) // bottom
break;
case LCR_BLOCK_RAMP_CORNER:
ADD(6,0,6) ADD(0,0,0) ADD(6,4,0) // diagonal
ADD(6,0,6) ADD(6,4,0) ADD(6,0,0) // right
ADD(0,0,0) ADD(6,0,0) ADD(6,4,0) // front
ADD(0,0,0) ADD(6,0,6) ADD(6,0,0) // bottom
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)

View file

@ -207,6 +207,60 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
#undef _CHECK_NEXT
case LCR_BLOCK_RAMP_CORNER:
{
TPE_Unit sides[6];
sides[0] = -1 * LCR_PHYSICS_UNIT / 2;
sides[1] = -1 * LCR_PHYSICS_UNIT / 4;
sides[2] = LCR_PHYSICS_UNIT / 2;
sides[3] = -1 * LCR_PHYSICS_UNIT / 4;
sides[4] = LCR_PHYSICS_UNIT / 2;
sides[5] = LCR_PHYSICS_UNIT / 4;
if (point.x > LCR_PHYSICS_UNIT / 2)
{
sides[4] *= -1;
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),
sides,LCR_PHYSICS_UNIT,2);
}
else if (point.z < -1 * LCR_PHYSICS_UNIT / 2)
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),
sides,LCR_PHYSICS_UNIT,0);
else if (point.y < -1 * LCR_PHYSICS_UNIT / 4)
{
sides[1] *= 2;
sides[3] *= 2;
sides[5] *= 2;
point = TPE_envAATriPrism(point,
TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT / 2,1);
}
else
{
point = TPE_envHalfPlane(point,TPE_vec3(LCR_PHYSICS_UNIT / 2,
LCR_PHYSICS_UNIT / 4,-1 * LCR_PHYSICS_UNIT / 2),
TPE_vec3(-1 * LCR_PHYSICS_UNIT,2 * LCR_PHYSICS_UNIT,LCR_PHYSICS_UNIT));
#define LINESNAP(a,b,c,d,e,f)\
point = TPE_envLineSegment(point,\
TPE_vec3(a * LCR_PHYSICS_UNIT / 2,b * LCR_PHYSICS_UNIT / 4,\
c * LCR_PHYSICS_UNIT / 2),TPE_vec3(d * LCR_PHYSICS_UNIT / 2,\
e * LCR_PHYSICS_UNIT / 4,f * LCR_PHYSICS_UNIT / 2));
if (point.y < -1 * LCR_PHYSICS_UNIT / 4)
LINESNAP(-1,-1,-1,1,-1,1)
else if (point.x > LCR_PHYSICS_UNIT / 2)
LINESNAP(1,1,-1,1,-1,1)
else if (point.z < -1 * LCR_PHYSICS_UNIT / 2)
LINESNAP(-1,-1,-1,1,1,-1)
#undef LINESNAP
}
break;
}
case LCR_BLOCK_RAMP:
case LCR_BLOCK_RAMP_34:
case LCR_BLOCK_RAMP_12: