Add blocks

This commit is contained in:
Miloslav Ciz 2025-01-29 15:01:11 +01:00
parent 6986028e33
commit be11c582b1
4 changed files with 73 additions and 27 deletions

2
data
View file

@ -1,4 +1,4 @@
#Mmap2;4321 1 :*H1k0J :,s0s0 :fd190
#Mmap2;4321 1 :=s0s0 :-u0s0 :;w0s0 :,y0s0 :.s0u0 :Is0w0 :'s1y0
#Bnomap
#Rrep2;testmap;482f70f9 00000843:0173:0081:0029:0111:0039:0071:00a3:0061:0169:0051:00b3:0041:0073:0081:0033:0041:0033:0231:0030:0098:0029:0011:0163:00f1:0053:0081:0033:0051:0023:0031:00f0:0032:0023:0131:00b9:0081:0023:00a1:0119:00e1:00c9:0071:0039:00a1:00d3:0021:01f9:0091:0079:0091:0039:0051:0049:0021:0083:0031:0083:0031:0083:0061:0089:0121:00a0:0058:002c:0048:0061:0013:0150:0052:00c0:00a1:0053:0041:0043:0031:0020:0092:0063:0181:0010:00a2:0013:0071:00e0:0028:00e9:0078:00a9:0043:0032:0123:0042:0080:0038:004c:01a8:0050:0032:0033:0101
#Btestmap;

63
map.h
View file

@ -89,11 +89,13 @@
#define LCR_BLOCK_BOTTOM '-' ///< filled bottom half
#define LCR_BLOCK_LEFT ';' ///< filled left half
#define LCR_BLOCK_BOTTOM_LEFT ',' ///< filled bottom left quarter
#define LCR_BLOCK_BOTTOM_LEFT_FRONT '.' ///< filled bottom left front eigth
#define LCR_BLOCK_BOTTOM_LEFT_FRONT '.' ///< filled bottom left front eighth
#define LCR_BLOCK_LEFT_FRONT 'I' ///< filled left front quarter
#define LCR_BLOCK_RAMP '^' ///< plain ramp
#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_12_UP '\'' ///< ramp, 1/2 size, elevated up
#define LCR_BLOCK_RAMP_CORNER 'v' ///< corner of a ramp
#define LCR_BLOCK_RAMP_CURVED_PLAT ']' ///< curved ramp with top platgform
#define LCR_BLOCK_RAMP_CURVED ')' ///< curv. ramp without top platf.
@ -114,7 +116,7 @@
#define LCR_BLOCK_RAMP_FAN 'V'
#define LCR_BLOCK_CHECKPOINT_0 '+' ///< checkpoint, not taken
#define LCR_BLOCK_CHECKPOINT_1 '\'' ///< checkpoint, taken
#define LCR_BLOCK_CHECKPOINT_1 '\t' ///< checkpoint, taken
#define LCR_BLOCK_FINISH '!' ///< finish
@ -701,23 +703,27 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
case LCR_BLOCK_LEFT:
case LCR_BLOCK_BOTTOM_LEFT:
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
case LCR_BLOCK_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 ||
uint8_t
xRight = 6 >>
(blockType == LCR_BLOCK_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
blockType == LCR_BLOCK_LEFT_FRONT),
yTop = 4 >>
(blockType == LCR_BLOCK_BOTTOM ||
blockType == LCR_BLOCK_BOTTOM_ACCEL ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
yTop /= 2;
if (blockType == LCR_BLOCK_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
xRight /= 2;
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT),
zBack = 6 >>
(blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
blockType == LCR_BLOCK_LEFT_FRONT);
ADD(0,0,0) ADD(xRight,0,0) ADD(xRight,yTop,0) // front
ADD(0,0,0) ADD(xRight,yTop,0) ADD(0,yTop,0)
@ -793,6 +799,21 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
ADD(0,0,0) ADD(0,0,6) ADD(6,0,6)
break;
case LCR_BLOCK_RAMP_12_UP:
ADD(0,2,0) ADD(0,4,6) ADD(0,0,6) // side
ADD(0,0,0) ADD(0,2,0) ADD(0,0,6)
ADD(6,2,0) ADD(6,0,6) ADD(6,4,6) // side
ADD(6,0,0) ADD(6,0,6) ADD(6,2,0)
ADD(0,2,0) ADD(6,2,0) ADD(0,4,6) // top
ADD(6,2,0) ADD(6,4,6) ADD(0,4,6)
ADD(0,0,6) ADD(6,4,6) ADD(6,0,6) // back
ADD(0,0,6) ADD(0,4,6) ADD(6,4,6)
ADD(0,0,0) ADD(6,0,0) ADD(6,2,0) // front
ADD(0,0,0) ADD(6,2,0) ADD(0,2,0)
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)
break;
case LCR_BLOCK_RAMP:
case LCR_BLOCK_RAMP_12:
case LCR_BLOCK_RAMP_14:
@ -806,13 +827,13 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
front = 6 - front;
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(6,0,front) ADD(6,0,6) ADD(6,top,6)
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(6,0,front) ADD(6,top,6) ADD(0,top,6)
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,6) ADD(0,top,6) ADD(6,top,6)
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
ADD(0,0,front) ADD(6,0,6) ADD(6,0,front)
break;
}
@ -823,11 +844,11 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
uint8_t right = blockType == LCR_BLOCK_CORNER ? 6 : 3;
ADD(0,0,0) ADD(right,0,6) ADD(right,4,6) // front/right
ADD(0,0,0) ADD(right,4,6) ADD(0,4,0) // front/right
ADD(0,0,0) ADD(right,4,6) ADD(0,4,0)
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(0,0,0) ADD(0,4,0) ADD(0,4,6)
ADD(right,0,6) ADD(0,0,6) ADD(0,4,6) // back
ADD(0,4,6) ADD(right,4,6) ADD(right,0,6) // back
ADD(0,4,6) ADD(right,4,6) ADD(right,0,6)
ADD(0,4,0) ADD(right,4,6) ADD(0,4,6) // top
ADD(0,0,6) ADD(right,0,6) ADD(0,0,0) // bottom
@ -903,7 +924,7 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
{
for (int i = 0; i < *byteCount; ++i)
{
uint8_t x, y, z, tmp;
uint8_t x, y, z;
_LCR_decodeMapBlockCoords(bytes[i],&x,&y,&z);

View file

@ -413,6 +413,7 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
case LCR_BLOCK_LEFT:
case LCR_BLOCK_BOTTOM_LEFT:
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
case LCR_BLOCK_LEFT_FRONT:
case LCR_BLOCK_FULL_ACCEL:
case LCR_BLOCK_FULL_FAN:
{
@ -432,13 +433,15 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
if (block[0] == LCR_BLOCK_LEFT ||
block[0] == LCR_BLOCK_BOTTOM_LEFT ||
block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
block[0] == LCR_BLOCK_LEFT_FRONT)
{
offset.x -= LCR_PHYSICS_UNIT / 4;
size.x = LCR_PHYSICS_UNIT / 4;
}
if (block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
if (block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT ||
block[0] == LCR_BLOCK_LEFT_FRONT)
{
offset.z -= LCR_PHYSICS_UNIT / 4;
size.z = LCR_PHYSICS_UNIT / 4;
@ -535,6 +538,28 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
break;
}
case LCR_BLOCK_RAMP_12_UP:
{
TPE_Unit sides[6];
sides[0] = LCR_PHYSICS_UNIT / 2;
sides[1] = LCR_PHYSICS_UNIT / 4;
sides[2] = -1 * LCR_PHYSICS_UNIT / 2;
sides[3] = 0;
sides[4] = LCR_PHYSICS_UNIT / 2;
sides[5] = -1 * LCR_PHYSICS_UNIT / 4;
_CHECK_NEXT(TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,
LCR_PHYSICS_UNIT,2));
_CHECK_NEXT(TPE_envAABox(
point,TPE_vec3(0,-1 * LCR_PHYSICS_UNIT / 8,0),TPE_vec3(
LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 8,LCR_PHYSICS_UNIT / 2)));
point = vBest;
break;
}
#undef _CHECK_NEXT
case LCR_BLOCK_RAMP_CORNER:

View file

@ -159,7 +159,7 @@
#ifndef LCR_SETTING_DEBUG_PHYSICS_DRAW
/** If on, physics world will be drawn. */
#define LCR_SETTING_DEBUG_PHYSICS_DRAW 0
#define LCR_SETTING_DEBUG_PHYSICS_DRAW 1
#endif
#ifndef LCR_SETTING_POTATO_GRAPHICS