~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/gameengine/GameLogic/SCA_ISensor.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
}
102
102
 
103
103
void SCA_ISensor::SetPulseMode(bool posmode, 
104
 
                                                           bool negmode,
105
 
                                                           int freq) {
 
104
                               bool negmode,
 
105
                               int freq)
 
106
{
106
107
        m_pos_pulsemode = posmode;
107
108
        m_neg_pulsemode = negmode;
108
109
        m_pulse_frequency = freq;
247
248
                if (result) {
248
249
                        // the sensor triggered this frame
249
250
                        if (m_state || !m_tap) {
250
 
                                ActivateControllers(logicmgr);  
 
251
                                ActivateControllers(logicmgr);
251
252
                                // reset these counters so that pulse are synchronized with transition
252
253
                                m_pos_ticks = 0;
253
254
                                m_neg_ticks = 0;
379
380
};
380
381
 
381
382
 
382
 
PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 
383
PyObject *SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
383
384
{
384
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
385
 
        int retval = 0;
 
385
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 
386
        bool retval = false;
386
387
        if (SCA_PythonController::m_sCurrentController)
387
388
                retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
388
 
        return PyLong_FromSsize_t(retval);
389
 
}
390
 
 
391
 
PyObject* SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
392
 
{
393
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
394
 
        return PyLong_FromSsize_t(self->GetState());
395
 
}
396
 
 
397
 
PyObject* SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
398
 
{
399
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
 
389
        return PyBool_FromLong(retval);
 
390
}
 
391
 
 
392
PyObject *SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 
393
{
 
394
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
 
395
        return PyBool_FromLong(self->GetState());
 
396
}
 
397
 
 
398
PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 
399
{
 
400
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
400
401
        int status = 0;
401
402
        if (self->GetState()) 
402
403
        {
413
414
        {
414
415
                status = 3;
415
416
        }
416
 
        return PyLong_FromSsize_t(status);
 
417
        return PyLong_FromLong(status);
417
418
}
418
419
 
419
 
PyObject* SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 
420
PyObject *SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
420
421
{
421
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
 
422
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
422
423
        return PyLong_FromLong(self->GetPosTicks());
423
424
}
424
425
 
425
 
PyObject* SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 
426
PyObject *SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
426
427
{
427
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
 
428
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
428
429
        return PyLong_FromLong(self->GetNegTicks());
429
430
}
430
431
 
431
432
int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
432
433
{
433
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
 
434
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
434
435
        if (self->m_level)
435
436
                self->m_tap = false;
436
437
        return 0;
438
439
 
439
440
int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
440
441
{
441
 
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
 
442
        SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
442
443
        if (self->m_tap)
443
444
                self->m_level = false;
444
445
        return 0;