Пример #1
0
void CRoboRed::processMoving()
{
  // Move normally in the direction
  if( xDirection == RIGHT )
  {
    moveRight( moveHorizSpeed );
  }
  else
  {
    moveLeft( moveHorizSpeed );
  }
  
  if(getProbability(60) && mKeenNearby)
  {
    setAction(A_RED_PAUSE);
  }
}
Пример #2
0
void CArachnut::getTouchedBy(CSpriteObject &theObject)
{
    if( theObject.dead )
        return;

    if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) )
    {
        bullet->setAction(A_KEENSHOT_IMPACT);
        bullet->playSound( SOUND_SHOT_HIT );
        setAction(A_ARACHNUT_STUNNED);
    }

    if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
    {
        player->kill();
    }
}
Пример #3
0
void CDopeFish::processEat()
{
	moveDope(DOPE_BITE_SPEED);

	if(m_eatTimer>0)
	{
		m_eatTimer--;
	}
	else
	{
		m_eatTimer = 0;
		setAction(A_DOPEFISH_START_BURP);

		m_burped = false;
		mp_processState = &CDopeFish::processBurp;
	}
}
UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent)
{
    QLOG_INFO() << "UASActionsWidget creating " << this;
    m_uas = NULL;
    ui.setupUi(this);
    connect(ui.changeAltitudeButton,SIGNAL(clicked()),this,SLOT(changeAltitudeClicked()));
    connect(ui.changeSpeedButton,SIGNAL(clicked()),this,SLOT(changeSpeedClicked()));
    connect(ui.goToWaypointButton,SIGNAL(clicked()),this,SLOT(goToWaypointClicked()));
    connect(ui.armDisarmButton,SIGNAL(clicked()),this,SLOT(armButtonClicked()));
    connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));

    if (UASManager::instance()->getActiveUAS())
    {
        activeUASSet(UASManager::instance()->getActiveUAS());
    }

    // Setup Action Combo Box
    ui.actionComboBox->addItem("Loiter Unlimited", MAV_CMD_NAV_LOITER_UNLIM);
    ui.actionComboBox->addItem("Return To Launch", MAV_CMD_NAV_RETURN_TO_LAUNCH);
    ui.actionComboBox->addItem("Preflight Calibration", MAV_CMD_PREFLIGHT_CALIBRATION);
    ui.actionComboBox->addItem("Mission Start", MAV_CMD_MISSION_START);
    ui.actionComboBox->addItem("Preflight Reboot", MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN);

    connect(ui.exeActionButton, SIGNAL(clicked()),
            this, SLOT(setAction()));

    // Mode Shortcut Buttons
    connect(ui.autoModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.stabilizeModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.rtlModeButton, SIGNAL(clicked()),
            this, SLOT(setRTLMode()));
    connect(ui.loiterModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));

    connect(ui.opt1ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt2ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt3ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt4ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
}
Пример #5
0
void CRoboRed::getTouchedBy(CSpriteObject &theObject)
{
    if(dead || theObject.dead)
        return;

    CStunnable::getTouchedBy(theObject);

    // Was it a bullet?
    if( dynamic_cast<CBullet*>(&theObject) && !getActionNumber(A_RED_SHOOT) )
    {
        setAction(A_RED_PAUSE);
    }

    if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
    {
        player->kill();
    }
}
Пример #6
0
bool Unit::init()
{
	if (_unitDefiniation)
	{
		std::string csb = _unitDefiniation->getName();
		cocos2d::Node * node = cocos2d::CSLoader::createNode(csb);
		cocostudio::timeline::ActionTimeline * action = cocos2d::CSLoader::createTimeline(csb);

		if (node) setEntry(node);
		if (action) setAction(action);

		if (node && action)
		{
			node->runAction(action);
		}
	}
	return true;
}
Пример #7
0
void CreateNewEventCommand::redo()
{
  if (mpEventData == NULL)
    {
      mpEventWidget->createNewEvent();

      std::string sName = mpEventWidget->mpEvent->getObjectName();
      mpEventData = new UndoEventData(mpEventWidget->mpEvent);
      setName(sName);
    }
  else
    {
      mpEventWidget->addEvent(mpEventData);
    }

  setUndoState(true);
  setAction("Create");
}
Пример #8
0
void CBobba::processJumping()
{
	// Move normally in the direction
	if( xDirection == RIGHT )
	{
		moveRight( MOVE_X_SPEED );
	}
	else
	{
		moveLeft( MOVE_X_SPEED );
	}
	
	if(blockedd && yinertia >= 0)
	{
	    setAction(A_BOBBA_SIT);
	    playSound(SOUND_BOBBA_LAND);
	}
}
Пример #9
0
void insertReactionRowsCommand::redo()
{
  mpReactionDM->insertNewReactionRow(mPosition, mRows, QModelIndex());
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);
  CModel * pModel = pDataModel->getModel();
  assert(pModel != NULL);
  mpReaction = pModel->getReactions()[mPosition];
  std::string sName = mpReaction->getObjectName();
  mpReactionData->setName(sName);
  CReactionInterface* ri = new CReactionInterface((*CCopasiRootContainer::getDatamodelList())[0]->getModel());
  ri->initFromReaction(mpReaction);
  mpReactionData->setRi(ri);
  setUndoState(true);
  setAction("Add to list");
  setName(mpReactionData->getName());
}
Пример #10
0
void TTRssFetcher::finishedSetAction()
{
    if (!processResponse()) {
        return;
    }

    auto db = DatabaseManager::instance();

    DatabaseManager::Action action = actionsList.takeFirst();
    db->removeActionsByIdAndType(action.id1, action.type);

    emit uploadProgress(uploadProggressTotal - actionsList.size(), uploadProggressTotal);

    if (actionsList.isEmpty()) {
        startFetching();
    } else {
        setAction();
    }
}
Пример #11
0
void MenuButton::setAction(const QString & name)
{
  if (actionName() == name)
    return;

  if (_guiClientInterface)
  {
    QAction *action = _guiClientInterface->findAction(name);
    if (!action)
    {
      // Create one so property can be saved.  Maybe gui client
      // action name provided will be valid in another instance.
      action = new QAction(this);
      action->setObjectName(name);
      action->setEnabled(false);
    }
    setAction(action);
  }
}
Пример #12
0
void CBobba::processSitting()
{
    mTimer++;

    if(mTimer < SIT_TIME)
	return;
    
    mTimer = 0;
    
    setAction(A_BOBBA_SHOOT);
    playSound(SOUND_BOBBA_SHOOT);    
    int x_coord = getXMidPos();
    x_coord += (xDirection == LEFT) ? -(8<<STC) : +(8<<STC);
    
    CEnemyShot *fireball = new CEnemyShot(mp_Map, 0, x_coord, getYUpPos(),
                       0x2E76, xDirection, 0,  100, mSprVar);
    spawnObj( fireball );
    
}
Пример #13
0
void MenuButton::actionEvent(QActionEvent *event)
{
    QAction *action = event->action();
    switch (event->type())
    {
    case QEvent::ActionChanged:
        if (action == _action)
            setAction(action); // update button state
        break;
    case QEvent::ActionRemoved:
        if (_action == action)
            _action = 0;
        action->disconnect(this);
        break;
    default:
        ;
    }
    QWidget::actionEvent(event);
}
Пример #14
0
void Scene3700::postInit(tSage::SceneObjectList *OwnerList) {
	Scene::postInit();
	loadScene(3700);

	_stripManager.addSpeaker(&_speakerSText);
	_stripManager.addSpeaker(&_speakerMText);
	_stripManager.addSpeaker(&_speakerMR);
	_speakerSText.setTextPos(Common::Point(20, 15));
	_speakerMText.setTextPos(Common::Point(20, 15));

	_viewer.postInit();
	_viewer.setVisage(3705);
	_viewer.setStrip(1);
	_viewer.setFrame(2);
	_viewer.setPosition(Common::Point(195, 83));

	setAction(&_action1);
	_globals->_soundHandler.startSound(195);
}
Пример #15
0
void Scene1001::postInit(SceneObjectList *OwnerList) {
	loadScene(16);
	Scene::postInit();
	setZoomPercents(0, 100, 200, 100);

	_stripManager.addSpeaker(&_speakerQText);
	_stripManager.addSpeaker(&_speakerCText);
	_stripManager.addSpeaker(&_speakerCR);
	_stripManager.addSpeaker(&_speakerSL);
	_speakerQText._color1 = 11;

	_object3.postInit();
	_object3.setVisage(16);
	_object3.setStrip2(4);
	_object3.setPosition(Common::Point(61, 177));

	_globals->_soundHandler.play(85);
	setAction(&_action1);
}
void CreateNewGlobalQuantityCommand::redo()
{
  if (mpGlobalQuantityData == NULL)
    {
      // TODO: this is again needs to happen only once
      mpModelValue->createNewGlobalQuantity();
      std::string sName = mpModelValue->mpModelValue->getObjectName();
      mpGlobalQuantityData = new UndoGlobalQuantityData(mpModelValue->mpModelValue);
      setName(sName);
    }
  else
    {
      mpModelValue->addGlobalQuantity(mpGlobalQuantityData);
    }

  setUndoState(true);
  setAction("Create");

}
Пример #17
0
void CreateNewSpeciesCommand::redo()
{
  if (mpSpeciesData == NULL)
    {
      // TODO: should only happen once
      mpSpeciesDetail->createNewSpecies();
      std::string sName = mpSpeciesDetail->mpMetab->getObjectName();
      mpSpeciesData = new UndoSpeciesData(mpSpeciesDetail->mpMetab);
      setName(sName);
    }
  else
    {
      mpSpeciesDetail->addSpecies(mpSpeciesData);
    }

  setUndoState(true);
  setAction("Create");

}
Пример #18
0
UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent)
{
    QLOG_INFO() << "UASActionsWidget creating " << this;
    m_uas = NULL;
    ui.setupUi(this);
    connect(ui.changeAltitudeButton,SIGNAL(clicked()),this,SLOT(changeAltitudeClicked()));
    connect(ui.changeSpeedButton,SIGNAL(clicked()),this,SLOT(changeSpeedClicked()));
    connect(ui.goToWaypointButton,SIGNAL(clicked()),this,SLOT(goToWaypointClicked()));
    connect(ui.armDisarmButton,SIGNAL(clicked()),this,SLOT(armButtonClicked()));
    connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));

    if (UASManager::instance()->getActiveUAS())
    {
        activeUASSet(UASManager::instance()->getActiveUAS());
    }

    ui.missionGroupBox->setDisabled(true);
    ui.actionsGroupBox->setDisabled(true);
    ui.shortcutGroupBox->setDisabled(true);

    connect(ui.exeActionButton, SIGNAL(clicked()),
            this, SLOT(setAction()));

    // Mode Shortcut Buttons
    connect(ui.autoModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.stabilizeModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.rtlModeButton, SIGNAL(clicked()),
            this, SLOT(setRTLMode()));
    connect(ui.loiterModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));

    connect(ui.opt1ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt2ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt3ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
    connect(ui.opt4ModeButton, SIGNAL(clicked()),
            this, SLOT(setShortcutMode()));
}
void InGameMenuWindow::createMenu(MenuBase* menu)
{
	CEGUI::WindowManager* windowMan = CEGUI::WindowManager::getSingletonPtr();

	const ActionVector actions = ActionManager::getSingleton().getInGameGlobalActions();
	map<CeGuiString, PopupMenu*> menuGroups;

	for (ActionVector::const_iterator actIter = actions.begin(); actIter != actions.end(); actIter++)
	{
        Action* action = *actIter;
		ActionGroup* group = action->getGroup();
		if (group != NULL)
		{
			PopupMenu* menuGrp;
			map<CeGuiString, PopupMenu*>::iterator grpIter = menuGroups.find(group->getName());
			if (grpIter != menuGroups.end())
			{
				menuGrp = (*grpIter).second;
			}
			else
			{
				MenuItem* grpItem = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
					getNamePrefix()+"IngameMenu/"+group->getName()));
				grpItem->setText(group->getName());
				menu->addChildWindow(grpItem);

				menuGrp = static_cast<PopupMenu*>(windowMan->createWindow("RastullahLook/PopupMenu",
					getNamePrefix()+"IngameMenu/Menu"+group->getName()));
				grpItem->addChildWindow(menuGrp);

				menuGroups[group->getName()] = menuGrp;
			}

			MenuItem* item = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
				getNamePrefix()+"IngameMenu/"+group->getName()+"/"+action->getName()));
			item->setText(action->getDescription());
			menuGrp->addChildWindow(item);

			setAction(item, action);
		}
	}
}
Пример #20
0
void CPoisonSlug::getTouchedBy(CSpriteObject &theObject)
{
	if(dead || theObject.dead)
		return;

	CStunnable::getTouchedBy(theObject);

	// Was it a bullet? Than make it stunned.
	if( dynamic_cast<CBullet*>(&theObject) )
	{
		setAction( rand()%2 ? A_SLUG_STUNNED : A_SLUG_STUNNED_ALT );
		dead = true;
		theObject.dead = true;
	}

	if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
	{
		player->kill();
	}
}
void CMimrock::processBounce()
{
    if(xDirection == LEFT)
    {
	moveLeft(JUMP_SPEED);
    }
    else
    {
	moveRight(JUMP_SPEED);
    }
    
    if(mTimer>0)
	mTimer--;
    
    if(mTimer == 0 && blockedd)
    {
	mTimer = TIME_UNTIL_LOOK;
	setAction(A_MIMROCK_SIT);	
    }
}
Пример #22
0
void CShelly::processWalking()
{ 
    
    if( blockedl )
    {
	xDirection = RIGHT;
    }
    else if(blockedr)
    {
	xDirection = LEFT;
    }
    
    // Move normally in the direction
    moveXDir(xDirection*WALK_SPEED);   
        
    if(mGoodJumpChance)
    {
	setAction(A_SHELLY_PREPARE_JUMP);
    }
}
Пример #23
0
void CKorath::getTouchedBy(CSpriteObject &theObject)
{
	if(dead || theObject.dead)
		return;

	CStunnable::getTouchedBy(theObject);

	// Was it a bullet? Than make it stunned.
	if( dynamic_cast<CBullet*>(&theObject) )
	{
		dead = true;
		theObject.dead = true;
		setAction(A_KORATH_STUNNED);
	}

	if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) )
	{
	  player->push(*this);
	}
}
Пример #24
0
static void initargs(int argc, char **argv)
{
    int c;

    CmdName = cmdName(argv[0]);
    opterr = 0;
    while ((c = getopt(argc, argv, ":gdo:")) != -1) {
	switch (c) {
	case 'd':
	    act = ToGV;
	    break;
	case 'g':
	    act = ToGXL;
	    break;
	case 'o':
	    outFile = openFile(optarg, "w");
	    break;
	case ':':
	    fprintf(stderr, "%s: option -%c missing argument\n", CmdName, optopt);
	    break;
	case '?':
	    if (optopt == '?')
		usage(0);
	    else {
		fprintf(stderr, "%s: option -%c unrecognized\n", CmdName,
			optopt);
		exit(1);
	    }
	}
    }

    argv += optind;
    argc -= optind;

    if (argc > 0)
	Files = argv;
    if (!outFile)
	outFile = stdout;
    if (act == Unset)
	setAction();
}
Пример #25
0
void Monster::processAttack()
{
    if (!mTarget)
    {
        setAction(STAND);
        return;
    }

    if (!mCurrentAttack)
        return;

    mAttackTimeout.set(mCurrentAttack->aftDelay
                                 + mCurrentAttack->preDelay);

    float damageFactor = mCurrentAttack->damageFactor;

    Damage dmg;
    dmg.skill   = 0;
    dmg.base    = getModifiedAttribute(MOB_ATTR_PHY_ATK_MIN) * damageFactor;
    dmg.delta   = getModifiedAttribute(MOB_ATTR_PHY_ATK_DELTA) * damageFactor;
    dmg.cth     = getModifiedAttribute(ATTR_ACCURACY);
    dmg.element = mCurrentAttack->element;
    dmg.range   = mCurrentAttack->range;

    int hit = performAttack(mTarget, dmg);

    if (!mCurrentAttack->scriptEvent.empty() && hit > -1)
    {
        Script::Ref function = mSpecy->getEventCallback(mCurrentAttack->scriptEvent);
        if (function.isValid())
        {
            Script *script = ScriptManager::currentState();
            script->setMap(getMap());
            script->prepare(function);
            script->push(this);
            script->push(mTarget);
            script->push(hit);
            script->execute();
        }
    }
}
Пример #26
0
bool CMimrock::isNearby(CObject &theObject)
{
	if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
	{
		const int dx = player->getXMidPos() - getXMidPos();

		if( dx>-CSF_DISTANCE_TO_FOLLOW_TOLERANCE &&
			dx<+CSF_DISTANCE_TO_FOLLOW_TOLERANCE	)
		{
			if( dx<0 )
				m_hDir = LEFT;
			else
				m_hDir = RIGHT;

			setAction(A_MIMROCK_WALK);
			mp_processState = (void (CStunnable::*)()) &CMimrock::processWalk;
		}
	}

	return true;
}
Пример #27
0
void CBip::processWalking()
{
    // Move normally in the direction
    if( xDirection == RIGHT )
    {
	moveRight( WALK_SPEED );
    }
    else
    {
	moveLeft( WALK_SPEED );
    }
    
  mTimer++;
  
  if(mTimer < WALK_TIME)
    return;  
  
  mTimer = 0;
  setAction(A_BIP_STAND);
	
}
Пример #28
0
void ObjetVolant::test(actionObjetVolant action, QPointF pointArrivee, double angleArrivee, double vitesseArrivee)
{
    animationRoot->stop();
    setAction(action);

    int ms;
    double distance;
    double angleRadian;
    QPointF newPosition;
    double newAngle;
    double newVitesse;

    ms = 25;
    distance = vitesse() * ms;
    angleRadian = rad(angle());

    newAngle = angle() + vitesseAngulaire() * ms;
    newVitesse = vitesse() + acceleration() * ms;
    newPosition = position() + QPointF(cos(angleRadian) * distance,
                                       sin(angleRadian) * distance);
}
Пример #29
0
void CDevilSprite::processShoot()
{
	m_timer--;

	if( m_timer == SPRITE_SHOOT_DELAY/2 )
	{
		gSound.playSound(SOUND_SPRITE_SHOT);
		int x_coord = getXMidPos();
		x_coord += (xDirection == LEFT) ? -(8<<STC) : +(8<<STC);
		CEnemyShot *Spark = new CEnemyShot(mpMap, 0, x_coord, getYMidPos()-(8<<STC),
                                            0x3818, xDirection, 0,  100, 0);
		gEventManager.add( new EventSpawnObject( Spark ) );
	}

	if( m_timer <= 0 )
	{
		m_timer = SPRITE_MOVE_DELAY;
		setAction(A_SPRITE_MOVE);
		mp_processState = &CDevilSprite::processMove;
	}
}
Пример #30
0
bool CLick::isNearby(CSpriteObject &theObject)
{    
    const bool odd = getProbability(80);
    
    
    if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
    {
	const int dy = abs(player->getYMidPos() - getYMidPos());
	const int dx = player->getXMidPos() - getXMidPos();
	
	if( dy > CSF_MIN_DISTANCE_TO_BREATHE )
	    return false;
	
	if( dx<-CSF_DISTANCE_TO_FOLLOW_TOLERANCE && odd )
	    xDirection = LEFT;
	else if( dx>+CSF_DISTANCE_TO_FOLLOW_TOLERANCE && odd )
	    xDirection = RIGHT;
	
	if(getActionNumber(A_LICK_LAND))
	{
	    int absdx = (dx<0) ? -dx : dx;
	    
	    if( absdx < CSF_DISTANCE_TO_FOLLOW_TOLERANCE )
		keenNear = true;
	    else
		keenNear = false;
	    
	    
	    if( absdx < CSF_MIN_DISTANCE_TO_BREATHE && odd )
	    {
		setAction(A_LICK_BREATHE);
		playSound(SOUND_LICK_FIREBREATH);
		m_timer = LICK_BREATHE_TIMER;
	    }
	}
	
    }
    
    return true;
}