diff --git a/racing.h b/racing.h index 093c8a4..a9cb9a0 100644 --- a/racing.h +++ b/racing.h @@ -66,6 +66,10 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit #define LCR_CAR_STEER_SPEED (LCR_GAME_UNIT / 17) #define LCR_CAR_STEER_MAX (LCR_GAME_UNIT / 2) +#define LCR_CAR_ACCELERATOR_FACTOR 2 +#define LCR_CAR_WHEEL_AIR_ROTATION_SPEED (LCR_GAME_UNIT / 32) +#define LCR_CAR_WHEEL_GROUND_SPEED_DIV 8 + #define LCR_CAR_DRIFT_THRESHOLD_1 (LCR_GAME_UNIT / 4) #define LCR_CAR_DRIFT_THRESHOLD_0 (LCR_GAME_UNIT / 200) @@ -1080,7 +1084,7 @@ void _LCR_racingWheelAccelerate(unsigned int wheel, TPE_Vec3 dir, acc = acc / (1 + (LCR_racingGetCarSpeedUnsigned() / LCR_CAR_AIR_FRICTION)); if (accelerator) - acc *= 2; // TODO: constant? + acc *= LCR_CAR_ACCELERATOR_FACTOR; LCR_racing.carBody.joints[wheel].velocity[0] += (dir.x * acc) / TPE_F; LCR_racing.carBody.joints[wheel].velocity[1] += (dir.y * acc) / TPE_F; @@ -1163,7 +1167,8 @@ uint32_t LCR_racingStep(unsigned int input) { TPE_Unit upDot = TPE_vec3Dot(carUp,TPE_vec3(0,TPE_F,0)); - if (upDot > TPE_F / 8 || upDot < -1 * TPE_F / 8) // TODO: consts + // if car is "somwhat" upwards (TPE_F / 8 is a hardcoded constant): + if (upDot > TPE_F / 8 || upDot < -1 * TPE_F / 8) { uint8_t gx = (LCR_racing.carPositions[0].x + (LCR_MAP_SIZE_BLOCKS / 2) * @@ -1173,6 +1178,13 @@ uint32_t LCR_racingStep(unsigned int input) gz = (LCR_racing.carPositions[0].z + (LCR_MAP_SIZE_BLOCKS / 2) * LCR_GAME_UNIT) / LCR_GAME_UNIT; +/* TODO: this shit below looks wrong: + - in the conditions yMod < LCR_GAME_UNIT / 2 can't ever happen because we + did % (LCR_GAME_UNIT / 2)? + + FIX +*/ + TPE_Unit yMod = (LCR_racing.carPositions[0].y + LCR_MAP_SIZE_BLOCKS * LCR_GAME_UNIT / 2) % (LCR_GAME_UNIT / 2); @@ -1239,7 +1251,8 @@ uint32_t LCR_racingStep(unsigned int input) { LCR_GameUnit rotateBy = (LCR_racing.wheelCollisions & 0x0f) ? // on ground slow down wheel rot. - (LCR_racingGetCarSpeedUnsigned() / 8) : LCR_GAME_UNIT / 32; + (LCR_racingGetCarSpeedUnsigned() / LCR_CAR_WHEEL_GROUND_SPEED_DIV) : + LCR_CAR_WHEEL_AIR_ROTATION_SPEED; if (!(input & LCR_RACING_INPUT_BACK)) rotateBy *= -1;