Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 1:10:46 AM (16 years ago)
Author:
rgrieder
Message:

SVN doesn't seem to like me. Reverted some really badly converted line endings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/core/InputManager.cc

    r1494 r1495  
    4141#include "KeyBinder.h"
    4242#include "CommandExecutor.h"
    43 #include "ConsoleCommand.h"#include "Shell.h"
     43#include "ConsoleCommand.h"
     44#include "Shell.h"
     45
    4446namespace orxonox
    4547{
     
    150152      addKeyHandler(buffer_, "buffer");
    151153      Shell::getInstance().setInputBuffer(buffer_);
     154
    152155      keyBinder_ = new KeyBinder();
    153156      keyBinder_->loadBindings();
     
    194197        // register our listener in OIS.
    195198        keyboard_->setEventCallback(this);
    196         // note: OIS will not detect keys that have already been down when the keyboard was created.        CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl;
     199        // note: OIS will not detect keys that have already been down when the keyboard was created.
     200        CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl;
    197201        return true;
    198202      }
     
    310314  void InputManager::setConfigValues()
    311315  {
    312     if (joySticksSize_)    {      std::vector<MultiTypeMath> coeffPos;
     316    if (joySticksSize_)
     317    {
     318      std::vector<MultiTypeMath> coeffPos;
    313319      std::vector<MultiTypeMath> coeffNeg;
    314320      std::vector<MultiTypeMath> zero;
     
    323329      }
    324330
    325       ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos");      if (!cont)      {          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffPos", coeffPos);          getIdentifier()->addConfigValueContainer("CoeffPos", cont);      }      cont->getValue(&coeffPos);      cont = getIdentifier()->getConfigValueContainer("CoeffNeg");      if (!cont)      {          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffNeg", coeffNeg);          getIdentifier()->addConfigValueContainer("CoeffNeg", cont);      }      cont->getValue(&coeffNeg);      cont = getIdentifier()->getConfigValueContainer("Zero");      if (!cont)      {          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "Zero", zero);          getIdentifier()->addConfigValueContainer("Zero", cont);      }      cont->getValue(&zero);      // copy values to our own variables      for (unsigned int i = 0; i < 24; i++)      {        joySticksCalibration_[0].positiveCoeff[i] = coeffPos[i];        joySticksCalibration_[0].negativeCoeff[i] = coeffNeg[i];        joySticksCalibration_[0].zeroStates[i]    = zero[i];      }    }  }
     331      ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos");
     332      if (!cont)
     333      {
     334          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffPos", coeffPos);
     335          getIdentifier()->addConfigValueContainer("CoeffPos", cont);
     336      }
     337      cont->getValue(&coeffPos);
     338
     339      cont = getIdentifier()->getConfigValueContainer("CoeffNeg");
     340      if (!cont)
     341      {
     342          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffNeg", coeffNeg);
     343          getIdentifier()->addConfigValueContainer("CoeffNeg", cont);
     344      }
     345      cont->getValue(&coeffNeg);
     346
     347      cont = getIdentifier()->getConfigValueContainer("Zero");
     348      if (!cont)
     349      {
     350          cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "Zero", zero);
     351          getIdentifier()->addConfigValueContainer("Zero", cont);
     352      }
     353      cont->getValue(&zero);
     354
     355      // copy values to our own variables
     356      for (unsigned int i = 0; i < 24; i++)
     357      {
     358        joySticksCalibration_[0].positiveCoeff[i] = coeffPos[i];
     359        joySticksCalibration_[0].negativeCoeff[i] = coeffNeg[i];
     360        joySticksCalibration_[0].zeroStates[i]    = zero[i];
     361      }
     362    }
     363  }
    326364
    327365  /**
     
    624662      else
    625663        joySticksCalibration_[0].positiveCoeff[i] =  1.0f;
     664
    626665      // config value
    627       ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos");      assert(cont);      cont->set(i, joySticksCalibration_[0].positiveCoeff[i]);      // negative coefficient
     666      ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos");
     667      assert(cont);
     668      cont->set(i, joySticksCalibration_[0].positiveCoeff[i]);
     669
     670      // negative coefficient
    628671      if (marginalsMin_[i] == INT_MAX)
    629672        marginalsMin_[i] = -32768;
    630673      // coefficients
    631674      if (marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i])
    632         joySticksCalibration_[0].negativeCoeff[i] = -1.0f/(marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i]);      else        joySticksCalibration_[0].negativeCoeff[i] =  1.0f;      // config value
    633       cont = getIdentifier()->getConfigValueContainer("CoeffNeg");      assert(cont);      cont->set(i, joySticksCalibration_[0].negativeCoeff[i]);      // zero states
     675        joySticksCalibration_[0].negativeCoeff[i] = -1.0f/(marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i]);
     676      else
     677        joySticksCalibration_[0].negativeCoeff[i] =  1.0f;
     678      // config value
     679      cont = getIdentifier()->getConfigValueContainer("CoeffNeg");
     680      assert(cont);
     681      cont->set(i, joySticksCalibration_[0].negativeCoeff[i]);
     682
     683      // zero states
    634684      if (i < 8)
    635685      {
     
    647697      }
    648698      // config value
    649       cont = getIdentifier()->getConfigValueContainer("Zero");      assert(cont);      cont->set(i, joySticksCalibration_[0].zeroStates[i]);    }
     699      cont = getIdentifier()->getConfigValueContainer("Zero");
     700      assert(cont);
     701      cont->set(i, joySticksCalibration_[0].zeroStates[i]);
     702    }
    650703  }
    651704
Note: See TracChangeset for help on using the changeset viewer.