Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic/SCA_KeyboardSensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index c6c06846e3b..43ce25f94df 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -77,7 +77,7 @@ void SCA_KeyboardSensor::Init()
// by the state engine. It reinitializes the sensor as if it was just created.
// However, if the target key is pressed when the sensor is reactivated, it
// will not generated an event (see remark in Evaluate()).
- m_val = 0;
+ m_val = (m_invert)?1:0;
}
CValue* SCA_KeyboardSensor::GetReplica()
@@ -176,10 +176,10 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
{
if (m_val == 0)
{
- //see comment below
- //m_val = 1;
- //result = true;
- ;
+ if (m_level) {
+ m_val = 1;
+ result = true;
+ }
}
} else
{
@@ -229,15 +229,11 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
{
if (m_val == 0)
{
- //hmm, this abnormal situation may occur in the following cases:
- //- the key was pressed while the scene was suspended
- //- this is a new scene and the key is active from the start
- //In the second case, it's dangerous to activate the sensor
- //(think of a key to go to next scene)
- //What we really need is a edge/level flag in the key sensor
- //m_val = 1;
- //result = true;
- ;
+ if (m_level)
+ {
+ m_val = 1;
+ result = true;
+ }
}
}
}