Add curved corners
This commit is contained in:
parent
485b09ccbc
commit
93cc5369bd
4 changed files with 79 additions and 5 deletions
2
assets.h
2
assets.h
|
@ -24,6 +24,8 @@ static const char *LCR_maps[] =
|
|||
"#=s0B0 #fd910" // concrete wall
|
||||
"#^s1A0 #fk110" // ramps before wall
|
||||
|
||||
"#nu0j1 #ly0j1 #AA0j1 "
|
||||
|
||||
"#vw0m0"
|
||||
"#vx0m0J"
|
||||
"#vw0l0L"
|
||||
|
|
28
map.h
28
map.h
|
@ -96,7 +96,6 @@
|
|||
#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 '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.
|
||||
#define LCR_BLOCK_RAMP_CURVED_WALL '}' ///< curved ramp plus small wall
|
||||
|
@ -108,6 +107,11 @@
|
|||
#define LCR_BLOCK_FULL_FAN 'o'
|
||||
#define LCR_BLOCK_BUMP '~' ///< small bump on the road
|
||||
|
||||
#define LCR_BLOCK_CORNER_CONVEX 'n'
|
||||
#define LCR_BLOCK_CORNER_CONCAVE 'l'
|
||||
|
||||
|
||||
|
||||
#define LCR_BLOCK_CHECKPOINT_0 '+' ///< checkpoint, not taken
|
||||
#define LCR_BLOCK_CHECKPOINT_1 '\'' ///< checkpoint, taken
|
||||
|
||||
|
@ -821,6 +825,28 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
|||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_CORNER_CONVEX:
|
||||
case LCR_BLOCK_CORNER_CONCAVE:
|
||||
{
|
||||
uint8_t
|
||||
mx = blockType == LCR_BLOCK_CORNER_CONVEX ? 4 : 2,
|
||||
mz = blockType == LCR_BLOCK_CORNER_CONVEX ? 2 : 4;
|
||||
|
||||
ADD(0,0,0) ADD(0,4,6) ADD(0,0,6) // left
|
||||
ADD(0,0,0) ADD(0,4,0) ADD(0,4,6) // left
|
||||
ADD(6,0,6) ADD(0,0,6) ADD(0,4,6) // back
|
||||
ADD(0,4,6) ADD(6,4,6) ADD(6,0,6) // back
|
||||
ADD(0,0,0) ADD(mx,4,mz) ADD(0,4,0) // right
|
||||
ADD(mx,0,mz) ADD(mx,4,mz) ADD(0,0,0)
|
||||
ADD(6,4,6) ADD(mx,4,mz) ADD(6,0,6)
|
||||
ADD(6,0,6) ADD(mx,4,mz) ADD(mx,0,mz)
|
||||
ADD(0,4,0) ADD(mx,4,mz) ADD(0,4,6) // top
|
||||
ADD(0,4,6) ADD(mx,4,mz) ADD(6,4,6)
|
||||
ADD(0,0,0) ADD(0,0,6) ADD(mx,0,mz) // bottom
|
||||
ADD(0,0,6) ADD(6,0,6) ADD(mx,0,mz)
|
||||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_BUMP:
|
||||
ADD(3,0,0) ADD(6,0,3) ADD(3,1,3) // top
|
||||
ADD(6,0,3) ADD(3,0,6) ADD(3,1,3)
|
||||
|
|
36
racing.h
36
racing.h
|
@ -205,6 +205,40 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_CORNER_CONVEX:
|
||||
case LCR_BLOCK_CORNER_CONCAVE:
|
||||
{
|
||||
TPE_Unit sides[6];
|
||||
sides[0] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[1] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[2] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[3] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[4] = LCR_PHYSICS_UNIT / 5;
|
||||
sides[5] = -1 * LCR_PHYSICS_UNIT / 5;
|
||||
|
||||
if (block[0] == LCR_BLOCK_CORNER_CONCAVE)
|
||||
{
|
||||
sides[4] *= -1;
|
||||
sides[5] *= -1;
|
||||
}
|
||||
|
||||
_CHECK_NEXT(TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT / 2
|
||||
,1));
|
||||
|
||||
sides[2] = sides[4];
|
||||
sides[3] = sides[5];
|
||||
|
||||
sides[4] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[5] = LCR_PHYSICS_UNIT / 2;
|
||||
|
||||
_CHECK_NEXT(TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT / 2
|
||||
,1));
|
||||
|
||||
point = vBest;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#undef _CHECK_NEXT
|
||||
|
||||
case LCR_BLOCK_RAMP_CORNER:
|
||||
|
@ -434,8 +468,6 @@ TPE_Vec3 _LCR_racingEnvironmentFunction(TPE_Vec3 point, TPE_Unit maxDist)
|
|||
TPE_ENV_END
|
||||
}
|
||||
|
||||
|
||||
|
||||
LCR_GameUnit LCR_racingGetCarSpeedUnsigned(void)
|
||||
{
|
||||
return LCR_racing.carSpeed >= 0 ? LCR_racing.carSpeed :
|
||||
|
|
18
renderer.h
18
renderer.h
|
@ -720,11 +720,25 @@ uint8_t _LCR_buildMapModel(void)
|
|||
uint8_t blockMat = LCR_mapBlockGetMaterial(block);
|
||||
|
||||
#define VERT(n,c) LCR_renderer.mapVerts[3 * n + c]
|
||||
|
||||
triData =
|
||||
(((VERT(triIndices[0],0) == VERT(triIndices[1],0)) &&
|
||||
(((VERT(triIndices[0],0) == VERT(triIndices[1],0)) && // same X?
|
||||
(VERT(triIndices[1],0) == VERT(triIndices[2],0))) << 4) |
|
||||
(((VERT(triIndices[0],2) == VERT(triIndices[1],2)) &&
|
||||
(((VERT(triIndices[0],2) == VERT(triIndices[1],2)) && // same Z?
|
||||
(VERT(triIndices[1],2) == VERT(triIndices[2],2))) << 5);
|
||||
|
||||
if (!(triData & 0xf0))
|
||||
{
|
||||
// diagonal walls
|
||||
|
||||
triData = (
|
||||
(VERT(triIndices[0],0) == VERT(triIndices[1],0) &&
|
||||
VERT(triIndices[0],2) == VERT(triIndices[1],2)) |
|
||||
(VERT(triIndices[1],0) == VERT(triIndices[2],0) &&
|
||||
VERT(triIndices[1],2) == VERT(triIndices[2],2)) |
|
||||
(VERT(triIndices[0],0) == VERT(triIndices[2],0) &&
|
||||
VERT(triIndices[0],2) == VERT(triIndices[2],2))) << 4;
|
||||
}
|
||||
#undef VERT
|
||||
|
||||
if (triData & 0xf0) // wall?
|
||||
|
|
Loading…
Reference in a new issue