Ejemplo n.º 1
0
int ClockwGallery::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 10)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 10;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = screenOn(); break;
        case 1: *reinterpret_cast< bool*>(_v) = appearAnimation(); break;
        case 2: *reinterpret_cast< bool*>(_v) = disappearAnimation(); break;
        case 3: *reinterpret_cast< bool*>(_v) = moveAnimation(); break;
        case 4: *reinterpret_cast< bool*>(_v) = rotateAnimation(); break;
        case 5: *reinterpret_cast< int*>(_v) = spawnTime(); break;
        case 6: *reinterpret_cast< int*>(_v) = appearTime(); break;
        case 7: *reinterpret_cast< int*>(_v) = range(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setScreenOn(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAppearAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 2: setDisappearAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 3: setMoveAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 4: setRotateAnimation(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSpawnTime(*reinterpret_cast< int*>(_v)); break;
        case 6: setAppearTime(*reinterpret_cast< int*>(_v)); break;
        case 7: setRange(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 2
0
/********************************************************************************
Hero Update
********************************************************************************/
void CPlayerInfo::HeroUpdate(float timeDiff, CAIManager* ai_manager, GameObjectFactory* go_manager, CMap* map, Sound UpdateSound)
{
	if(currentState != DYING)
	{
		// Update Hero's info
		switch(currentState)
		{
		case CPlayerInfo::KNOCKED_BACKING:
			{
				moving(timeDiff, map);
			}
			break;
		case CPlayerInfo::ATTACKING:
			{
				Attacking(timeDiff, ai_manager, go_manager, UpdateSound);
			}
			break;
		default:
			{
				Vector3 HeroPrevPos = theHeroPosition;
				moving(timeDiff, map);
				if(currentState == MOVING)
				{
					moveAnimation(timeDiff, HeroPrevPos);
				}
			}
			break;
		}
		if(currentState == NIL)
		{
			if(theHeroCurrentPosNode->posType != 0
				&& theHeroCurrentPosNode->posType < CPosNode::TOTAL_ACTIVE_GO)
			{
				if(CheckCollisionCurrent())
				{
					CollisionResponseCurrent();
				}
			}
		}

		// Flicker hero when got damaged
		if(justGotDamged)
		{
			if(timeElasped < 1.f)
			{
				timeElasped += timeDiff;
				if(unrenderOrRenderTimeLeft < 0.02f)
				{
					unrenderOrRenderTimeLeft += timeDiff;
				}
				else
				{
					unrenderOrRenderTimeLeft = 0.f;
					if(RenderHero)
					{
						RenderHero = false;
					}
					else
					{
						RenderHero = true;
					}
				}
			}
			else
			{
				timeElasped = 0.f;
				unrenderOrRenderTimeLeft = 0.f;
				justGotDamged = false;
				RenderHero = true;
			}
		}
	}
	else
	{
		// Death animation
		if(timeElasped < 2.f)
		{
			if(theHeroCurrentPosNode->posType == CPosNode::HOLE)
			{
				holeDropScale -= timeDiff;
				if(holeDropScale < 0.1)
					holeDropScale = 0.1;
			}
			timeElasped += timeDiff;
			heroAnimationCounter += 20 * timeDiff;
			if(heroAnimationCounter > 5.0f)
				heroAnimationCounter = 5.0f;
		}
	}
}