From 008cfefc4dcaf6939a2e982be13401a96597fd37 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Thu, 12 Nov 2026 22:39:34 +0100 Subject: [PATCH] MiataDrive: unify A/D and arrow steering at 0.4 step --- examples/MiataDrive/MiataDrive.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/MiataDrive/MiataDrive.ino b/examples/MiataDrive/MiataDrive.ino index 2ab583c..be7e77c 100644 --- a/examples/MiataDrive/MiataDrive.ino +++ b/examples/MiataDrive/MiataDrive.ino @@ -97,11 +97,11 @@ static void addRoad(int enter, int hold, int leave, float curve, float hillY) { float endY = startY + hillY * SEG_LEN; int total = enter + hold + leave; for (int i = 0; i < enter; i++) - addSegment(easeIn(0, curve, (float)i / enter), easeInOut(startY, endY, (float)i / total)); + addSegment(easeIn(0, curve, (float)i / enter), easeInOut(startY, endY, (float)(i + 1) / total)); for (int i = 0; i < hold; i++) - addSegment(curve, easeInOut(startY, endY, (float)(enter + i) / total)); + addSegment(curve, easeInOut(startY, endY, (float)(enter + i + 1) / total)); for (int i = 0; i < leave; i++) - addSegment(easeInOut(curve, 0, (float)i / leave), easeInOut(startY, endY, (float)(enter + hold + i) / total)); + addSegment(easeInOut(curve, 0, (float)i / leave), easeInOut(startY, endY, (float)(enter + hold + i + 1) / total)); } static void addSprite(int segIdx, int type, float offRoadHalves) { @@ -130,7 +130,7 @@ static void buildTrack() { addRoad(25, 35, 25, 3, 0); // S bends addRoad(25, 35, 25, -3, 0); addRoad(40, 70, 40, 5, 20); // long right sweeper, uphill - addRoad(30, 30, 30, 0, -6); // downhill straight (tuned to close the elevation loop) + addRoad(30, 30, 30, 0, -10); // downhill straight (tuned to close the elevation loop) addRoad(30, 60, 30, -4, 0); // long left addRoad(20, 20, 20, 6, 0); // tight right addRoad(40, 40, 40, 0, 0); // finish straight @@ -867,11 +867,11 @@ static void pollKeyboard() { case 's': brakeUntil = millis() + 500; gasLatch = 0; break; case 'a': if (gameState == ST_SPRITES) { spritePage = (spritePage + 5) % 6; } - else { steerInput -= 0.8f; registerTurn(); } + else { steerInput -= 0.4f; registerTurn(); } break; case 'd': if (gameState == ST_SPRITES) { spritePage = (spritePage + 1) % 6; } - else { steerInput += 0.8f; registerTurn(); } + else { steerInput += 0.4f; registerTurn(); } break; case 'p': autoPlay = !autoPlay; break; case '1': playerColor = PC_RED; if (gameState == ST_TITLE) drawTitle(); break; @@ -955,7 +955,7 @@ void loop() { if ((int32_t)(now - brakeUntil) < 0) gasFrame = -1; if (gameState == ST_PLAYING && !autoPlay) { - if (pxX) { steerInput += (pxX > 0 ? 1 : -1) * 0.15f * (1 + (pxX > 3 ? 1 : 0)); registerTurn(); } + if (pxX) { steerInput += (pxX > 0 ? 1 : -1) * 0.4f; registerTurn(); } else steerInput *= 0.90f; // auto-center only when not steering steerInput = clampf(steerInput, -1, 1); }