コード例 #1
0
ファイル: Municao.cpp プロジェクト: filipexts/CompGraf_URGE
Municao::Municao()
{
    sphere();
    changeBoundingVolume(Solid::SPHERE);
    label(LABEL_MUNICAO);
    scale(1.0);
    body().gravityScale(0.001);
    body().damping(0.0);

    light.color(255,180,60);
    light.intensity(5.0);
    light.attenuation(0.4);
    light.quadraticAttenuation(0.01);

    visible(false);
    disappear();

    bala.generate(Particle::GLOW);
    bala.setAnimationType(Particle::FIRE);
    bala.color(130,70,20);
    bala.scale(1.25);

    spark.load("media/sprites/spark.tga");
    spark.setAnimationType(Particle::FOG);
    spark.color(200,100,40);
    spark.scale(1.0);
    spark.animationMotionOffset(3.5);
    spark.stop();
}
コード例 #2
0
ファイル: Enemy.cpp プロジェクト: JunMaru/BrushToothGame
//================================================================================
// 更新処理
//================================================================================
void Enemy::update(void)
{
    if(!m_bDeath)
    {
        //状態に応じた処理開始
        (this->*m_pFunc[m_actionMode])();
        //タイムが0なら強制的に行動させる
        if(m_time <= 0)
        {
            m_time = 0;
            m_actionMode = ACTION_NONE;
        }
        //HPが0なら消滅
        if(m_nLife <= 0)
        {
            m_nLife = 0;
            disappear();
        }
    }else{
        if(m_time > 0)
        {
            moveAction();
            m_move -= m_move * 0.01f;
        }
    }
}
コード例 #3
0
ファイル: Enemy.cpp プロジェクト: JunMaru/BrushToothGame
//================================================================================
//ダメージ処理
//================================================================================
void Enemy::addDamage(int nDamage)
{
    m_nLife -= nDamage;
    if (nDamage < 100)
    {
        //敵に攻撃したときのSE
        //音量調整
        SimpleAudioEngine::getInstance()->setEffectsVolume(SE_ENEMY_DOWN_VOLUME_3);
        SimpleAudioEngine::getInstance()->playEffect(SE_ENEMY_DOWN_1);
    }
    if(!m_bDeath)
    {
        //HPが0なら消滅
        if(m_nLife <= 0)
        {
            
            m_nLife = 0;
            disappear();
        }
        Sequence* pSequence = Sequence::create(ScaleTo::create(0.3f,0.5),ScaleTo::create(0.3f,1.25),ScaleTo::create(0.3f,1.0), NULL);
        m_pSprite->runAction(pSequence);

    }

}
コード例 #4
0
ファイル: BulletFactory.cpp プロジェクト: trotskey/Hokuhou
bool BulletFactory::Suck(float mDelta,Evertable * ever,const char * str){
	queue<Bullet*> temp;
	//const char * type("bonus");
	while(!current.empty()){
		Bullet * Bob = current.front();
		current.pop();
		IND_Entity2d * ent  = ever->getEntity();
		IND_Entity2d * ent2 =  Bob->getEntity();
		if((Bob->isEverted() == false) && mI->_entity2dManager->isCollision(ent,str,ent2,"bonus")){
			float ydiff = ent2->getPosY() - ent->getPosY();
			float xdiff = ent2->getPosX() - ent->getPosX();
			float strength = xdiff*xdiff+ydiff*ydiff;
			float xrate = xdiff*xdiff/strength;
			float yrate = 1-xrate;
			if(ydiff < 0){
				yrate = -yrate;
			}
			if(xdiff < 0){
				xrate = -xrate;
			}
			Bob->setXY(ent2->getPosX()-xrate*300*mDelta,ent2->getPosY()-yrate*300*mDelta);
			if(strength < 20){
				mScore->addtoScore(10);
				disappear(Bob);
			} else {
				temp.push(Bob);
			}
		} else {
			temp.push(Bob);
		}
	}
	current = temp;
	return true;
}
コード例 #5
0
ファイル: Arrow.cpp プロジェクト: vinhsteven/Hero
void Arrow::updateMove2(float fDeltaTime)
{
    m_fSpeed -= ACCELERATION_2 * (fDeltaTime / FRAME_DURATION);
    
    if (m_fSpeed < MIN_SPEED)
    {
        // Sets acceleration
        m_fAcceleration = ACCELERATION_3;
        
        // Updates move
        setCurrentState(Move);
    }
    else
    {
        CCPoint deltaPos = m_dir * m_fSpeed * fDeltaTime;
        
        float fLength = deltaPos.getLength();
        
        if (fLength < m_fRemainLength)
        {
            m_fRemainLength -= fLength;
            
            setPosition(m_obPosition + deltaPos);
        }
        else
        {
            m_fRemainLength = 0.0f;
            
            setPosition(m_endPos);
            
            // Disappear
            disappear();
        }
    }
}
コード例 #6
0
ファイル: RemoteAccessWidget.cpp プロジェクト: edceza/veyon
void RemoteAccessWidgetToolBar::connectionEstablished()
{
	m_connecting = false;
	m_iconStateTimeLine.stop();
	QTimer::singleShot( 3000, this, SLOT( disappear() ) );
	// within the next 1000ms the username should be known and therefore
	// we update
	QTimer::singleShot( 1000, this, SLOT( update() ) );
}
コード例 #7
0
ファイル: BulletFactory.cpp プロジェクト: trotskey/Hokuhou
bool BulletFactory::ClearScreen(){
	queue<Bullet*> temp;
	while(!current.empty()){
		Bullet * Bob = current.front();
		current.pop();
		disappear(Bob);
	}
	current = temp;
	return true;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: CCJY/coliru
void process(Wrap begin, Wrap end)
{
    ASM_MARKER();
    for (Wrap it = begin; ASM_MARKER(), it != end; ASM_MARKER(), ++it)
    {
        ASM_MARKER();
        disappear(*it);
    }
    ASM_MARKER();
}
コード例 #9
0
ファイル: main.cpp プロジェクト: CCJY/coliru
// Use simple pointer
void process(int* begin, int* end)
{
    ASM_MARKER();
    for (int* it = begin; ASM_MARKER(), it != end; ASM_MARKER(), ++it)
    {
        ASM_MARKER();
        disappear(*it);        
    }
    ASM_MARKER();
}
コード例 #10
0
ファイル: Municao.cpp プロジェクト: filipexts/CompGraf_URGE
int Municao::collide(Object &other)
{
    //if (other.label() == LABEL_ZUMBI)
    //{
        spark.start(10);
        spark.position() = position();
        disappear();
    //}
    return 1;
}
コード例 #11
0
ファイル: Zumbi.cpp プロジェクト: vkmagalhaes/CG-Trab1
void Zumbi::die(Object &other){
    disappear();
    Municao* municao;
    municao = (Municao*)&other;
    if( (*municao).position().y() > ( position().y()+0.3) ) {
        Text::write(100,50,"%s","HEADSHOT!");
        Score::addHeadShot();
    }
    else{
        Score::addKill();
    }
}
コード例 #12
0
void EnObjectWood::onEventReceived( const StoryEvent& /*event*/ )
{
    //UserInventory* p_inv = gameutils::PlayerUtils::get()->getPlayerInventory();
    //if ( !p_inv->increaseItem( ITEM_NAME_OBJ_WOOD, 1 ) )
    //{
    //    //! TODO ...assemble the item string out of entity attributes
    //    p_inv->addItem( ITEM_NAME_OBJ_WOOD, getActorID(), "test=10,test2=21" );
    //}

    //! TODO: get the respawn time from object attributes
    disappear( 5.0f );
}
コード例 #13
0
ファイル: Municao.cpp プロジェクト: filipexts/CompGraf_URGE
void Municao::act()
{
    bala.position() = position();
    light.position() = position();

    if (bala.isEmitting())
    {
        timer--;
        light.intensity(float(timer)*0.0715);
        if (timer <= 0)    disappear();
    }
}
コード例 #14
0
void StatusIndicatorMenuWindow::resetMenuWidget()
{
    if (menuWidget)
        delete menuWidget;

    menuWidget = new StatusIndicatorMenu();
    connect(menuWidget, SIGNAL(showRequested()), this, SLOT(makeVisible()));
    connect(menuWidget, SIGNAL(hideRequested()), menuWidget, SLOT(disappear()));
    connect(menuWidget, SIGNAL(disappeared()), this, SLOT(hideWindow()));

    // Initialize the status indicator menu after the first USB banner has been shown
    QTimer::singleShot(7000, this, SLOT(initializeMenuWidget()));
}
コード例 #15
0
Button *Window::addCloseButton(const QString &label) {
    Button *ok_button = new Button(label, 0.6);
    QFont font = Config.TinyFont;
    font.setBold(true);
    ok_button->setFont(font);
    ok_button->setParentItem(this);

    qreal x = size.width() - ok_button->boundingRect().width() - 25;
    qreal y = size.height() - ok_button->boundingRect().height() - 25;
    ok_button->setPos(x, y);

    connect(ok_button, SIGNAL(clicked()), this, SLOT(disappear()));
    return ok_button;
}
コード例 #16
0
ファイル: BulletFactory.cpp プロジェクト: trotskey/Hokuhou
bool BulletFactory::Move(float mDelta){
	queue<Bullet*> temp;
	while(!current.empty()){
		Bullet * Bob = current.front();
		current.pop();
		Bob->move(mDelta);
		if(Bob->inRange()){
			temp.push(Bob);
		} else {
			disappear(Bob);
		}
	}
	current = temp;
	return true;
}
コード例 #17
0
void PlayerCardBox::clear()
{
    if (progressBar != NULL) {
        progressBar->hide();
        progressBar->deleteLater();
        progressBar = NULL;

        progressBarItem->deleteLater();
    }

    foreach(CardItem *item, items)
        item->deleteLater();
    items.clear();

    disappear();
}
コード例 #18
0
ファイル: Enemy.cpp プロジェクト: JunMaru/BrushToothGame
//================================================================================
//敵が消える処理
//================================================================================
void Enemy::setEnemyDown(void)
{
    if(!m_bDeath)
    {
        disappear();
    }
    m_nLife = 0;
    m_bDeath = true;
    m_bDown = true;
    
    m_nEnemyDown[m_nEnemyKind]++;
    m_pSprite->stopAllActions();
    m_time = 0;
    m_bFollowPowder = false;
    m_pSprite->runAction(Spawn::create(FadeOut::create(0.8),MoveBy::create(1.0, Vec2(0,-300)), NULL));
}
コード例 #19
0
ファイル: BulletFactory.cpp プロジェクト: trotskey/Hokuhou
int BulletFactory::Hit(const char * type,Evertable * ever,const char * str){
	queue<Bullet*> temp;
	int ret = 0;
	while(!current.empty()){
		Bullet * Bob = current.front();
		current.pop();
		IND_Entity2d * ent  = ever->getEntity();
		IND_Entity2d * ent2 =  Bob->getEntity();
		if((Bob->isEverted() == ever->isEverted()) && mI->_entity2dManager->isCollision(ent,str,ent2,type)){
			ret++;
			disappear(Bob);
		} else {
			temp.push(Bob);
		}
	}
	current = temp;
	return ret;
}
コード例 #20
0
ファイル: spechit.c プロジェクト: naota/rogueclone2s-utf8
void
steal_gold(object *monster)
{
    int amount;

    if ((rogue.gold <= 0) || rand_percent(10)) {
	return;
    }

    amount = get_rand((cur_level * 10), (cur_level * 30));

    if (amount > rogue.gold) {
	amount = rogue.gold;
    }
    rogue.gold -= amount;
    message(mesg[204], 0);
    print_stats(STAT_GOLD);
    disappear(monster);
}
コード例 #21
0
ファイル: Elements.cpp プロジェクト: CludeX/SuperSector
void Barrier::draw()
{
    if(_isDisappear) return;

    float innerR,outerR;
    innerR = _parameter.innerR - GameScene::sharedInstance()->movedLength;
    outerR = _parameter.outerR - GameScene::sharedInstance()->movedLength;
    if(outerR <= 0.1)
    {
        //这句话可能造成屏幕闪烁
        //this->removeFromParent();

        //使用disappear()函数防止屏幕卡顿
        disappear();
        return;
    }
    if(innerR > 0.1)
    {

        CCSize size = CCDirector::sharedDirector()->getWinSize();
        ccDrawColor4B(146, 10, 36, 255);
        ccDrawAnnulus(ccp(0,0), innerR*size.width/2, outerR*size.width/2, CC_DEGREES_TO_RADIANS((_parameter.end-_parameter.start)*60), 20);
    }
    else if(outerR > 0.1)
    {
        innerR = 0.1;
        CCSize size = CCDirector::sharedDirector()->getWinSize();
        if(_parameter.outerR > _parameter.innerR)
        {
            ccDrawColor4B(146, 10, 36, 255);
            ccDrawAnnulus(ccp(0,0), innerR*size.width/2, outerR*size.width/2, CC_DEGREES_TO_RADIANS((_parameter.end-_parameter.start)*60), 20);
        }
    }
    //在这里做碰撞检测
    if(detactCollision())
    {
        GameScene::sharedInstance()->gameOver();
    }
    //glLineWidth(_outerRadius-_innerRadius);效果不好
    //ccDrawArc(ccp(0,0), _innerRadius, CC_DEGREES_TO_RADIANS((_end-_start)*60), 100, false);
    //ccDrawArc(ccp(0,0), _outerRadius, CC_DEGREES_TO_RADIANS((_end-_start)*60), 100, false);

}
コード例 #22
0
void ToolBarPage::textButtonsConfiguration()
{
    initDefaultViewToolBar();

    //% "Save"
    MAction* action = new MAction(qtTrId("xx_toolbar_page_tools_save"), this);
    action->setObjectName("saveAction");
    action->setLocation(MAction::ToolBarLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(disappear()));

    //% "Cancel"
    action = new MAction(qtTrId("xx_toolbar_page_tools_cancel"), this);
    action->setObjectName("cancelAction");
    action->setLocation(MAction::ToolBarLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(reset()));

    currentConfiguration = textButtons;
}
コード例 #23
0
ファイル: Arrow.cpp プロジェクト: vinhsteven/Hero
void Arrow::updateMove(float fDeltaTime)
{
    m_fSpeed += m_fAcceleration * (fDeltaTime / FRAME_DURATION);
    
    CCPoint deltaPos = m_dir * m_fSpeed * fDeltaTime;
    
    float fLength = deltaPos.getLength();
    
    if (fLength < m_fRemainLength)
    {
        m_fRemainLength -= fLength;
        
        setPosition(m_obPosition + deltaPos);
    }
    else
    {
        m_fRemainLength = 0.0f;
        
        setPosition(m_endPos);
        
        // Disappear
        disappear();
    }
}
コード例 #24
0
ファイル: lookalikemain_p.cpp プロジェクト: Igalia/lookalike
LookAlikeMainPrivate::LookAlikeMainPrivate(LookAlikeMain *q) :
    QObject(q),
    m_currentAction(0),
    q_ptr(q)
{
    // Less correct the problem with the DB first of all, if no other
    // application has dealt with it first.
    m_faceRecognitionResetter = new FaceRecognitionResetter();
    if (!m_faceRecognitionResetter->isDBCorrected()) {
        m_faceRecognitionResetter->dealWithDB(1);
    }

    m_galleryModel = new GalleryModel(this);
    m_galleryModel->setFaceRecognitionEnabled(true);
    QSparqlConnection *connection = m_galleryModel->sparqlConnection();
    m_trackerProvider = new TrackerContentProvider(connection, this);
    m_galleryModel->addContentProvider(m_trackerProvider);
    m_faceDatabaseProvider = new FaceDatabaseProvider(connection, this);
    m_faceTrackerProvider = new FaceTrackerProvider(connection, this);
    m_confirmedContactsListPage = new GalleryPeopleListPage(m_faceTrackerProvider->model());
    m_proposedContactsListPage = new GalleryPeopleListPage(m_faceDatabaseProvider);
    m_gridPage = new GalleryGridPage(*m_galleryModel);
    m_fullScreenPage = new GalleryFullScreenPage(*m_galleryModel);

    m_confirmedContactsListPage->setStyleName("GalleryPage");
    m_proposedContactsListPage->setStyleName("GalleryPage");
    m_gridPage->setStyleName("GalleryPage");
    m_fullScreenPage->setStyleName("GalleryPage");

    MAction* allTabAction = new MAction("icon-m-toolbar-all-content-white", "", q);
    allTabAction->setLocation(MAction::ToolBarLocation);
    allTabAction->setCheckable(true);

    MAction* confirmedContactsTabAction = new MAction("icon-m-toolbar-known-people-white", "", q);
    confirmedContactsTabAction->setLocation(MAction::ToolBarLocation);
    confirmedContactsTabAction->setCheckable(true);

    MAction* proposedContactsAction = new MAction("icon-m-toolbar-unknown-people-white", "", q);
    proposedContactsAction->setLocation(MAction::ToolBarLocation);
    proposedContactsAction->setCheckable(true);

    MAction* landscapeTabAction = new MAction("icon-m-toolbar-no-people-white", "", q);
    landscapeTabAction->setLocation(MAction::ToolBarLocation);
    landscapeTabAction->setCheckable(true);

    QList<QAction*> actions;
    actions.append(allTabAction);
    actions.append(confirmedContactsTabAction);
    actions.append(proposedContactsAction);
    actions.append(landscapeTabAction);

    MToolBar* toolbar = new MToolBar();
    toolbar->setStyleName("MToolbarTabStyleInverted");
    toolbar->setOpacity(0.9);
    toolbar->setViewType(MToolBar::tabType);
    toolbar->addActions(actions);

    m_toolbarAction = new MWidgetAction(q);
    m_toolbarAction->setLocation(MAction::ToolBarLocation);
    m_toolbarAction->setWidget(toolbar);

    m_confirmFaceAction = new MAction("Confirm faces", q);
    m_confirmFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_deleteFaceAction = new MAction("Delete faces", q);
    m_deleteFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_aboutAction = new MAction("About", q);
    m_aboutAction->setLocation(MAction::ApplicationMenuLocation);

    const QPixmap *pixmap = MTheme::pixmap("icon-m-toolbar-view-menu-dimmed-white");
    MImageWidget *menuImage = new MImageWidget();
    menuImage->setImage(pixmap->toImage());
    menuImage->setZoomFactor(1.f);
    menuImage->setMinimumWidth(88.f);
    MTheme::releasePixmap(pixmap);
    MWidgetAction* fakeAction= new MWidgetAction(q);
    fakeAction->setLocation(MAction::ToolBarLocation);
    fakeAction->setWidget(menuImage);

    m_confirmedContactsListPage->addAction(m_toolbarAction);
    m_confirmedContactsListPage->addAction(fakeAction);

    m_proposedContactsListPage->addAction(m_toolbarAction);
    m_proposedContactsListPage->addAction(fakeAction);

    connect(m_confirmedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onConfirmedContactSelected(QString,QString)));
    connect(m_proposedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onProposedContactPersonSelected(QString,QString)));
    connect(m_gridPage, SIGNAL(multiSelectionDone(QList<QUrl>)),
            this, SLOT(onMultiSelectionDone(QList<QUrl>)));
    connect(m_gridPage, SIGNAL(itemSelected(QUrl)),
            this, SLOT(onItemSelected(QUrl)));
    connect(m_fullScreenPage, SIGNAL(itemDeleted(QUrl)),
            m_faceDatabaseProvider, SLOT(update()));
    connect(m_trackerProvider, SIGNAL(dataChanged()),
            this, SLOT(onDataChanged()));
    connect(m_confirmFaceAction, SIGNAL(triggered()),
            this, SLOT(onConfirmFaceActionTriggered()));
    connect(m_deleteFaceAction, SIGNAL(triggered()),
            this, SLOT(onDeleteFaceActionTriggered()));
    connect(m_aboutAction, SIGNAL(triggered()),
            this, SLOT(onAboutActionTriggered()));
    connect(allTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onAllTabActionToggled(bool)));
    connect(confirmedContactsTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onConfirmedContactTabActionToggled(bool)));
    connect(proposedContactsAction, SIGNAL(toggled(bool)),
            this, SLOT(onProposedContactTabActionToggled(bool)));
    connect(landscapeTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onLandscapeTabActionToggled(bool)));
    connect(m_gridPage, SIGNAL(appeared()),
            this, SLOT(onGridPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(appeared()),
            this, SLOT(onFullscreenPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(loadingActiveItemFailed(QString)),
            m_fullScreenPage, SLOT(disappear()));
    connect(m_galleryModel, SIGNAL(galleryItemsRemoved(int,int)),
            this, SLOT(onGalleryItemsRemoved()));

    allTabAction->toggle();
}
コード例 #25
0
ファイル: RemoteAccessWidget.cpp プロジェクト: edceza/veyon
void RemoteAccessWidget::enterEvent( QEvent* event )
{
	QTimer::singleShot( 500, m_toolBar, SLOT( disappear() ) );
	QWidget::enterEvent( event );
}
コード例 #26
0
ファイル: Boss.cpp プロジェクト: joyfish/PlaneWar
void Boss::beinjured(const s32 value) {
    m_armor -= value;
    if (m_armor <= 0) {
        disappear();
    }
}
コード例 #27
0
ファイル: fire.cpp プロジェクト: TomasRiker/blocks-5
void Fire::onUpdate()
{
	// Feuer
	ParticleSystem* p_particleSystem = level.getParticleSystem();
	ParticleSystem* p_fireParticleSystem = level.getFireParticleSystem();
	ParticleSystem::Particle p;
	p.lifetime = random(60, 100);
	p.damping = 0.9f;
	p.gravity = -0.04f;
	p.positionOnTexture = Vec2b(32, 0);
	p.sizeOnTexture = Vec2b(16, 16);
	p.position = position * 16 + Vec2i(random(6, 10), random(6, 10));
	p.velocity = Vec2d(random(-0.5, 0.5), random(-0.5, 0.5));
	p.color = Vec4d(random(0.5, 1.0), random(0.8, 1.0), random(0.0, 0.25), random(0.2, 0.4));
	const double dc = -1.5 / (p.lifetime + random(-25, 25));
	p.deltaColor = Vec4d(dc, dc, dc, -p.color.a / p.lifetime);
	p.rotation = random(0.0f, 10.0f);
	p.deltaRotation = random(-0.1f, 0.1f);
	p.size = random(0.5f, 0.9f);
	p.deltaSize = random(-0.015f, -0.0075f);
	if(random() % 2) p_particleSystem->addParticle(p);
	else p_fireParticleSystem->addParticle(p);

	// Befindet sich ein Objekt auf dem Feuer?
	const std::vector<Object*> objectsOnMe = level.getObjectsAt(position);
	for(std::vector<Object*>::const_iterator i = objectsOnMe.begin(); i != objectsOnMe.end(); ++i)
	{
		Object* p_obj = *i;
		if(p_obj == this) continue;

		p_obj->onFire();

		if(p_obj->getFlags() & OF_DESTROYABLE)
		{
			p_obj->setDestroyTime(p_obj->getDestroyTime() - 1);
			if(!p_obj->getDestroyTime())
			{
				p_obj->disappear(0.2);
				debrisColor = p_obj->getDebrisColor();

				Engine::inst().playSound("vaporize.ogg", false, 0.15);

				// Trümmer
				int n = random(50, 80);
				for(int i = 0; i < n; i++)
				{
					p.lifetime = random(60, 120);
					p.damping = 0.9f;
					p.gravity = -0.1f;
					p.positionOnTexture = Vec2b(96, 0);
					p.sizeOnTexture = Vec2b(16, 16);
					p.position = p_obj->getPosition() * 16 + Vec2i(random(-2, 18), random(-2, 18));
					p.velocity = Vec2d(random(-0.2, 0.2), random(-0.2, 0.2));
					p.color = debrisColor + Vec4d(random(-0.1, 0.1), random(-0.1, 0.1), random(-0.1, 0.1), 0.0);
					p.deltaColor = Vec4d(0.0, 0.0, 0.0, -p.color.a / p.lifetime);
					p.rotation = random(0.0f, 10.0f);
					p.deltaRotation = random(-0.1f, 0.1f);
					p.size = random(0.5f, 1.5f);
					p.deltaSize = random(0.01f, 0.05f);
					if(random() % 2) p_particleSystem->addParticle(p);
					else p_fireParticleSystem->addParticle(p);
				}

				if(p_obj->getFlags() & OF_KILL_FIRE)
				{
					// Das Feuer geht jetzt aus!
					for(int i = 0; i < 50; i++)
					{
						p.lifetime = random(80, 150);
						p.damping = 0.9f;
						p.gravity = -0.03f;
						p.positionOnTexture = Vec2b(0, 0);
						p.sizeOnTexture = Vec2b(16, 16);
						p.position = position * 16 + Vec2i(random(6, 10), random(6, 10));
						const double r = random(0.0, 6.283);
						p.velocity = Vec2d(random(-0.5, 0.5), random(-0.5, 0.5));
						p.color = debrisColor + Vec4d(random(-0.1, 0.1), random(-0.1, 0.1), random(-0.1, 0.1), 0.0);
						const double dc = -0.5 / (p.lifetime + random(-25, 25));
						p.deltaColor = Vec4d(dc, dc, dc, -p.color.a / p.lifetime);
						p.rotation = random(0.0f, 10.0f);
						p.deltaRotation = random(-0.1f, 0.1f);
						p.size = random(0.6f, 0.9f);
						p.deltaSize = random(0.01f, 0.02f);
						if(random() % 2) p_particleSystem->addParticle(p);
						else p_fireParticleSystem->addParticle(p);
					}

					disappear(0.2);
				}
			}
		}
	}

	anim++;
}
コード例 #28
0
void Ut_StatusIndicatorMenuWindow::testInitialization()
{
    QVERIFY(statusIndicatorMenuWindow->menuWidget);

    QVERIFY(disconnect(statusIndicatorMenuWindow, SIGNAL(displayExited()), statusIndicatorMenuWindow, SLOT(displayInActive())));
    QVERIFY(disconnect(statusIndicatorMenuWindow, SIGNAL(displayEntered()), statusIndicatorMenuWindow, SLOT(displayActive())));

    QVERIFY(disconnect(statusIndicatorMenuWindow->menuWidget, SIGNAL(showRequested()), statusIndicatorMenuWindow, SLOT(makeVisible())));
    QVERIFY(disconnect(statusIndicatorMenuWindow->menuWidget, SIGNAL(hideRequested()), statusIndicatorMenuWindow->menuWidget, SLOT(disappear())));
    QVERIFY(disconnect(statusIndicatorMenuWindow->menuWidget, SIGNAL(disappeared()), statusIndicatorMenuWindow, SLOT(hideWindow())));

    QVERIFY(gSceneWindowStateMap.contains(statusIndicatorMenuWindow->menuWidget));
    QCOMPARE(gSceneWindowStateMap[statusIndicatorMenuWindow->menuWidget], MSceneWindow::Disappeared);
}
コード例 #29
0
ファイル: toxicgas.cpp プロジェクト: TomasRiker/blocks-5
void ToxicGas::onUpdate()
{
	if(!(random() % 3))
	{
		ParticleSystem* p_particleSystem = level.getParticleSystem();
		ParticleSystem* p_fireParticleSystem = level.getFireParticleSystem();
		ParticleSystem::Particle p;

		p.lifetime = random(10, 20);
		p.damping = 0.96f;
		p.gravity = -0.005f;
		if(random() % 2) p.positionOnTexture = Vec2b(0, 64);
		else p.positionOnTexture = Vec2b(0, 0);
		p.sizeOnTexture = Vec2b(16, 16);
		p.position = position * 16 + Vec2i(random(2, 14), random(2, 14));
		const double r = random(0.0, 6.283);
		p.velocity = random(0.0, 1.0) * Vec2d(sin(r), cos(r));
		p.color = Vec4d(random(0.4, 1.0), random(0.75, 1.0), random(0.0, 0.5), random(0.5, 1.5));
		p.deltaColor = Vec4d(0.0, 0.0, 0.0, -p.color.a / p.lifetime);
		p.rotation = random(0.0f, 10.0f);
		p.deltaRotation = random(-0.05f, 0.05f);
		p.size = 0.01f;
		p.deltaSize = random(0.05f, 0.25f);
		if(random() % 2) p_particleSystem->addParticle(p);
		else p_fireParticleSystem->addParticle(p);
	}

	std::vector<Object*> objects = level.getObjectsAt(position);
	for(std::vector<Object*>::const_iterator i = objects.begin(); i != objects.end(); ++i)
	{
		if((*i)->getFlags() & OF_BLOCK_GAS)
		{
			disappear(0.0);
			return;
		}
	}

	if(spreadCounter > 0) spreadCounter--;
	else if(spreadCounter == 0)
	{
		// in alle freien Richtungen ausbreiten
		for(int dir = 0; dir < 4; dir++)
		{
			Vec2i p = position + intToDir(dir);
			if(!level.isValidPosition(p)) continue;

			// wenn da schon Gas ist, abbrechen
			if(level.getAIFlags(p) & 2) continue;

			// Tiles blockieren das Gas.
			uint tileID = level.getTileAt(1, p);
			const TileSet::TileInfo& tileInfo = level.getTileSet()->getTileInfo(tileID);
			if(tileInfo.type == 1 || tileInfo.type == 2) continue;

			// Objekte?
			objects = level.getObjectsAt(p);
			bool blocked = false;
			for(std::vector<Object*>::const_iterator i = objects.begin(); i != objects.end(); ++i)
			{
				if((*i)->getFlags() & OF_BLOCK_GAS)
				{
					blocked = true;
					break;
				}
			}

			if(blocked) continue;

			// neues Gasobjekt erzeugen
			new ToxicGas(level, p);
		}

		spreadCounter = random(50, 80);
	}
}
コード例 #30
0
ファイル: spechit.c プロジェクト: naota/rogueclone2s-utf8
void
steal_item(object *monster)
{
    object *obj;
    short i, n, t = 0;		/* 未初期化変数の使用の警告のための初期化。 0 を代入 */
    char desc[80];
    boolean has_something = 0;

    if (rand_percent(15)) {
	return;
    }
    obj = rogue.pack.next_object;

    if (!obj) {
	goto DSPR;
    }
#if !defined( ORIGINAL )
    while (obj) {
	if ((obj->what_is == RING) &&
	    (obj->which_kind == ADORNMENT) &&
	    (obj->in_use_flags & ON_EITHER_HAND) && (obj->is_cursed == 0)) {
	    un_put_on(obj);
	    goto adornment;
	}
	obj = obj->next_object;
    }
    obj = rogue.pack.next_object;
#endif /* ORIGINAL */
    while (obj) {
	if (!(obj->in_use_flags & BEING_USED)) {
	    has_something = 1;
	    break;
	}
	obj = obj->next_object;
    }
    if (!has_something) {
	goto DSPR;
    }
    n = get_rand(0, MAX_PACK_COUNT);
    obj = rogue.pack.next_object;

    for (i = 0; i <= n; i++) {
	obj = obj->next_object;
	while ((!obj) || (obj->in_use_flags & BEING_USED)) {
	    if (!obj) {
		obj = rogue.pack.next_object;
	    } else {
		obj = obj->next_object;
	    }
	}
    }
#if !defined( ORIGINAL )
adornment:
#endif /* not ORIGINAL */
#if !defined( JAPAN )
    (void) strcpy(desc, mesg[205]);
#endif /* JAPAN */
    if (obj->what_is != WEAPON) {
	t = obj->quantity;
	obj->quantity = 1;
    }
#if defined( JAPAN )
    get_desc(obj, desc, 0);
    (void) strcat(desc, mesg[205]);
#else /* not JAPAN */
    get_desc(obj, desc + 10, 0);
#endif /* not JAPAN */
    message(desc, 0);

    obj->quantity = ((obj->what_is != WEAPON) ? t : 1);

    vanish(obj, 0, &rogue.pack);
DSPR:
    disappear(monster);
}