From 9c6f61e1566d02611706c1739dd7187ae4de89ac Mon Sep 17 00:00:00 2001 From: Chris Laurel Date: Tue, 22 Oct 2002 17:26:51 +0000 Subject: [PATCH] Added a RotateAcceleration field to the config file to control the sensitivity of keyboard and joystick navigation controls. --- src/celestia/celestiacore.cpp | 12 +++++++----- src/celestia/configfile.cpp | 3 +++ src/celestia/configfile.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/celestia/celestiacore.cpp b/src/celestia/celestiacore.cpp index f694d28b3..b8664deec 100644 --- a/src/celestia/celestiacore.cpp +++ b/src/celestia/celestiacore.cpp @@ -50,11 +50,11 @@ static const float fIncrementFactor = 10.0f; static const double fMinSlewRate = 3.0; static const double fMaxKeyAccel = 20.0; static const float fAltitudeThreshold = 4.0f; -static const float KeyRotationAccel = degToRad(120.0f); static const float RotationBraking = 10.0f; static const float RotationDecay = 2.0f; static const double MaximumTimeRate = 1.0e15; static const float stdFOV = 45.0f; +static float KeyRotationAccel = degToRad(120.0f); static void warning(string s) @@ -1028,13 +1028,13 @@ void CelestiaCore::tick() float fov = renderer->getFieldOfView()/stdFOV; if (keysPressed[Key_Left]) - av += Vec3f(0, 0, dt); + av += Vec3f(0, 0, dt * -KeyRotationAccel); if (keysPressed[Key_Right]) - av += Vec3f(0, 0, -dt); + av += Vec3f(0, 0, dt * KeyRotationAccel); if (keysPressed[Key_Down]) - av += Vec3f(dt * fov, 0, 0); + av += Vec3f(dt * fov * -KeyRotationAccel, 0, 0); if (keysPressed[Key_Up]) - av += Vec3f(-dt * fov, 0, 0); + av += Vec3f(dt * fov * KeyRotationAccel, 0, 0); if (keysPressed[Key_NumPad4]) av += Vec3f(0, dt * fov * -KeyRotationAccel, 0); @@ -1708,6 +1708,8 @@ bool CelestiaCore::initSimulation() return false; } + KeyRotationAccel = degToRad(config->rotateAcceleration); + readFavoritesFile(); // If we couldn't read the favorites list from a file, allocate diff --git a/src/celestia/configfile.cpp b/src/celestia/configfile.cpp index 0a559158b..1e88208a7 100644 --- a/src/celestia/configfile.cpp +++ b/src/celestia/configfile.cpp @@ -72,6 +72,9 @@ CelestiaConfig* ReadCelestiaConfig(string filename) // configParams->getNumber("LogoWidth", config->logoWidth); // configParams->getNumber("LogoHeight", config->logoHeight); + config->rotateAcceleration = 120.0f; + configParams->getNumber("RotateAcceleration", config->rotateAcceleration); + Value* solarSystemsVal = configParams->getValue("SolarSystemCatalogs"); if (solarSystemsVal != NULL) { diff --git a/src/celestia/configfile.h b/src/celestia/configfile.h index bec013133..100850bfa 100644 --- a/src/celestia/configfile.h +++ b/src/celestia/configfile.h @@ -33,6 +33,7 @@ struct CelestiaConfig std::string labelFont; std::string titleFont; std::string logoTextureFile; + float rotateAcceleration; };