Add more accels and fans
This commit is contained in:
parent
7c3eac7d9f
commit
5d9038021a
5 changed files with 42 additions and 72 deletions
3
assets.h
3
assets.h
|
@ -41,8 +41,7 @@ static const char *LCR_maps[] =
|
|||
"#=f0s0 #f11d0"
|
||||
"#=c0p0 #f11d0"
|
||||
|
||||
"#oC0s0 #fd190" // big dirt
|
||||
// "#=C0s1 #fd190" // big dirt
|
||||
"#=C0s1 #fd190" // big dirt
|
||||
"#=M0s2 #fd190" // big grass
|
||||
"#=W0s3 #fd190" // big ice
|
||||
|
||||
|
|
7
game.h
7
game.h
|
@ -196,8 +196,6 @@ void LCR_gameResetRun(void)
|
|||
LCR_racingRestart();
|
||||
LCR_rendererUnmarkCPs();
|
||||
LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
|
||||
|
||||
|
||||
LCR_rendererSetCarTransform(carTransform,carTransform + 3);
|
||||
LCR_rendererCameraReset();
|
||||
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
|
||||
|
@ -235,11 +233,6 @@ void LCR_gameEnd(void)
|
|||
LCR_LOG0("ending");
|
||||
}
|
||||
|
||||
void LCR_gameUpdateRendererCarTransform(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
uint8_t LCR_gameStep(uint32_t time)
|
||||
{
|
||||
LCR_LOG2("game step start");
|
||||
|
|
44
map.h
44
map.h
|
@ -103,10 +103,15 @@
|
|||
#define LCR_BLOCK_CORNER 'A' ///< diagonal corner
|
||||
#define LCR_BLOCK_CORNER_12 '\\' ///< diagonal corner (1/2 wide)
|
||||
#define LCR_BLOCK_HILL '(' ///< curved "hill"
|
||||
#define LCR_BLOCK_FULL_ACCEL '>'
|
||||
#define LCR_BLOCK_FULL_FAN 'o'
|
||||
#define LCR_BLOCK_BUMP '~' ///< small bump on the road
|
||||
|
||||
#define LCR_BLOCK_FULL_ACCEL '>'
|
||||
#define LCR_BLOCK_BOTTOM_ACCEL 'z'
|
||||
#define LCR_BLOCK_RAMP_ACCEL 'y'
|
||||
|
||||
#define LCR_BLOCK_FULL_FAN 'o'
|
||||
#define LCR_BLOCK_RAMP_FAN 'V'
|
||||
|
||||
#define LCR_BLOCK_CORNER_CONVEX 'n'
|
||||
#define LCR_BLOCK_CORNER_CONCAVE 'l'
|
||||
|
||||
|
@ -188,6 +193,17 @@ uint8_t LCR_mapBlockOppositeTransform(uint8_t transform)
|
|||
return transform;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsAccelerator(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_ACCEL || block == LCR_BLOCK_RAMP_ACCEL ||
|
||||
block == LCR_BLOCK_BOTTOM_ACCEL;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsFan(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_FAN || block == LCR_BLOCK_RAMP_FAN;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockGetTransform(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
{
|
||||
return block[3] & 0xf0;
|
||||
|
@ -195,7 +211,9 @@ uint8_t LCR_mapBlockGetTransform(const uint8_t block[LCR_BLOCK_SIZE])
|
|||
|
||||
uint8_t LCR_mapBlockGetMaterial(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
{
|
||||
return (block[3] >> 2) & 0x03;
|
||||
return (LCR_mapBlockIsAccelerator(block[0]) ||
|
||||
LCR_mapBlockIsFan(block[0])) ? LCR_BLOCK_MATERIAL_CONCRETE :
|
||||
((block[3] >> 2) & 0x03);
|
||||
}
|
||||
|
||||
uint32_t LCR_mapBlockGetCoordNumber(const uint8_t block[LCR_BLOCK_SIZE])
|
||||
|
@ -219,7 +237,8 @@ void LCR_rampGetDimensions(uint8_t rampType, uint8_t *height4ths,
|
|||
{
|
||||
*height4ths =
|
||||
(rampType == LCR_BLOCK_RAMP_14) +
|
||||
(rampType == LCR_BLOCK_RAMP || rampType == LCR_BLOCK_RAMP_STEEP) * 4 +
|
||||
(rampType == LCR_BLOCK_RAMP || rampType == LCR_BLOCK_RAMP_ACCEL ||
|
||||
rampType == LCR_BLOCK_RAMP_FAN || rampType == LCR_BLOCK_RAMP_STEEP) * 4 +
|
||||
(rampType == LCR_BLOCK_RAMP_12 || rampType == LCR_BLOCK_RAMP_34) * 2 +
|
||||
(rampType == LCR_BLOCK_RAMP_34);
|
||||
|
||||
|
@ -619,16 +638,6 @@ void _LCR_addBlockShapeByte(uint8_t *bytes, uint8_t *byteCount,
|
|||
*byteCount += 1;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsAccelerator(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_ACCEL;
|
||||
}
|
||||
|
||||
uint8_t LCR_mapBlockIsFan(uint8_t block)
|
||||
{
|
||||
return block == LCR_BLOCK_FULL_FAN;
|
||||
}
|
||||
|
||||
/**
|
||||
Macro that transforms coordinates according to block transformation.
|
||||
*/
|
||||
|
@ -691,11 +700,14 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
|||
case LCR_BLOCK_BOTTOM_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 || blockType == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
if (blockType == LCR_BLOCK_BOTTOM ||
|
||||
blockType == LCR_BLOCK_BOTTOM_ACCEL ||
|
||||
blockType == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
blockType == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
yTop /= 2;
|
||||
|
||||
|
@ -783,6 +795,8 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
|
|||
case LCR_BLOCK_RAMP_14:
|
||||
case LCR_BLOCK_RAMP_34:
|
||||
case LCR_BLOCK_RAMP_STEEP:
|
||||
case LCR_BLOCK_RAMP_ACCEL:
|
||||
case LCR_BLOCK_RAMP_FAN:
|
||||
{
|
||||
uint8_t front, top;
|
||||
LCR_rampGetDimensions(blockType,&top,&front);
|
||||
|
|
45
racing.h
45
racing.h
|
@ -121,6 +121,7 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
{
|
||||
case LCR_BLOCK_FULL:
|
||||
case LCR_BLOCK_BOTTOM:
|
||||
case LCR_BLOCK_BOTTOM_ACCEL:
|
||||
case LCR_BLOCK_LEFT:
|
||||
case LCR_BLOCK_BOTTOM_LEFT:
|
||||
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
|
||||
|
@ -133,6 +134,7 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
LCR_PHYSICS_UNIT / 2);
|
||||
|
||||
if (block[0] == LCR_BLOCK_BOTTOM ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_ACCEL ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
{
|
||||
|
@ -306,6 +308,8 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
case LCR_BLOCK_RAMP_12:
|
||||
case LCR_BLOCK_RAMP_14:
|
||||
case LCR_BLOCK_RAMP_STEEP:
|
||||
case LCR_BLOCK_RAMP_ACCEL:
|
||||
case LCR_BLOCK_RAMP_FAN:
|
||||
{
|
||||
uint8_t front, top;
|
||||
LCR_rampGetDimensions(block[0],&top,&front);
|
||||
|
@ -629,11 +633,6 @@ void LCR_racingInit(void)
|
|||
{
|
||||
LCR_LOG0("initializing racing engine");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TPE_worldInit(&(LCR_racing.physicsWorld),
|
||||
&(LCR_racing.carBody),1,_LCR_racingEnvironmentFunction);
|
||||
|
||||
|
@ -1017,43 +1016,8 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
if (TPE_vec3Dot(carVel,carForw) < 0)
|
||||
LCR_racing.carSpeed *= -1;
|
||||
|
||||
|
||||
|
||||
_LCR_racingUpdateCarPosRot();
|
||||
|
||||
/*
|
||||
TPE_Vec3 tmpVec = LCR_racing.carPositions[0];
|
||||
|
||||
TPE_Vec3 wheelAverage = _LCR_TPE_vec3DividePlain(
|
||||
TPE_vec3Plus(
|
||||
TPE_vec3Plus(
|
||||
LCR_racing.carBody.joints[0].position,
|
||||
LCR_racing.carBody.joints[1].position),
|
||||
TPE_vec3Plus(
|
||||
LCR_racing.carBody.joints[2].position,
|
||||
LCR_racing.carBody.joints[3].position)),4);
|
||||
|
||||
LCR_racing.carPositions[0] = _LCR_TPE_vec3DividePlain(
|
||||
TPE_vec3TimesPlain(wheelAverage,LCR_GAME_UNIT),LCR_PHYSICS_UNIT);
|
||||
|
||||
LCR_racing.carPositions[0] = // smooth the position
|
||||
TPE_vec3KeepWithinBox(LCR_racing.carPositions[1],LCR_racing.carPositions[0],
|
||||
TPE_vec3(
|
||||
LCR_PHYSICS_UNIT / 64, // TODO: constant
|
||||
LCR_PHYSICS_UNIT / 64,
|
||||
LCR_PHYSICS_UNIT / 64));
|
||||
|
||||
LCR_racing.carPositions[1] = tmpVec;
|
||||
|
||||
tmpVec = _LCR_TPE_vec3DividePlain(TPE_vec3TimesPlain(TPE_bodyGetRotation(
|
||||
&(LCR_racing.carBody),0,2,1),LCR_GAME_UNIT),TPE_F);
|
||||
|
||||
LCR_racing.carRotations[1] = LCR_racing.carRotations[0];
|
||||
LCR_racing.carRotations[0] = tmpVec;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
TPE_Unit angle = TPE_vec3Dot(carUp,TPE_vec3Normalized(TPE_vec3Minus(
|
||||
LCR_racing.carBody.joints[4].position,
|
||||
LCR_racing.carBody.joints[0].position)));
|
||||
|
@ -1118,7 +1082,6 @@ _LCR_racingUpdateCarPosRot();
|
|||
LCR_LOG1("car front pierced");
|
||||
|
||||
LCR_racing.carNotOKCount +=
|
||||
//(LCR_racing.carNotOKCount < 15 ? 32 : 0); // TODO: consts
|
||||
(LCR_racing.carNotOKCount < 20 ? 15 : 0); // TODO: consts
|
||||
}
|
||||
|
||||
|
|
|
@ -822,15 +822,16 @@ uint8_t _LCR_buildMapModel(void)
|
|||
triData |=
|
||||
((blockMat == LCR_BLOCK_MATERIAL_CONCRETE) ||
|
||||
(blockMat == LCR_BLOCK_MATERIAL_ICE) ||
|
||||
(blockType == LCR_BLOCK_FULL_ACCEL) ||
|
||||
(blockType == LCR_BLOCK_FULL_FAN)) ?
|
||||
LCR_mapBlockIsAccelerator(blockType) ||
|
||||
LCR_mapBlockIsFan(blockType)) ?
|
||||
LCR_IMAGE_WALL_CONCRETE : LCR_IMAGE_WALL_WOOD;
|
||||
}
|
||||
else
|
||||
{ // TODO: tidy this mess?
|
||||
if (blockType == LCR_BLOCK_FULL_ACCEL)
|
||||
|
||||
if (LCR_mapBlockIsAccelerator(blockType))
|
||||
triData |= LCR_IMAGE_GROUND_ACCEL;
|
||||
else if (blockType == LCR_BLOCK_FULL_FAN)
|
||||
else if (LCR_mapBlockIsFan(blockType))
|
||||
triData |= LCR_IMAGE_GROUND_FAN;
|
||||
else
|
||||
switch (blockMat)
|
||||
|
|
Loading…
Reference in a new issue