Ejemplo n.º 1
0
void Intro2::applyState()
{
	StateObject::applyState();


	ActionMapper::clearActions();

	//addAction(MakeFunctionEvent(Intro2, skipIntro), KEY_ESCAPE, 0);

	dsq->subtitlePlayer.show(0.5f);

	core->resetCamera();
	
	dsq->jiggleCursor();

	dsq->setCutscene(1,1);

	core->main(1);
	dsq->overlay->alpha.interpolateTo(0, 40);
	dsq->toggleCursor(0);

	// OLD WAY of skipping
	//dsq->user.control.actionSet.importAction(this, "Escape",		ACTION_ESC);

	Quad *frame4 = new Quad;
	{
		frame4->setTexture("gameover-0004");
		frame4->position = Vector(400,310);
		frame4->setWidthHeight(600, 600);
		frame4->setSegs(2, 32, 0.1, 0.1, 0.002, 0.003, 2.0, 1);
	}
	addRenderObject(frame4, LR_BACKGROUND);

	ParticleEffect *emitter = new ParticleEffect;
	emitter->load("NaijaIntro_Idle");

	emitter->position = Vector(400,300);
	addRenderObject(emitter, LR_PARTICLES);
	emitter->start();

	ParticleEffect *emitter3 = new ParticleEffect;
	emitter3->load("VerseEnergy2");
	emitter3->position = Vector(400,300);
	addRenderObject(emitter3, LR_PARTICLES);
	emitter3->start();

	ParticleEffect *emitter2 = new ParticleEffect;
	emitter2->load("NaijaIntro_Transition");
	emitter2->position = Vector(400,300);
	addRenderObject(emitter2, LR_PARTICLES);

	dsq->voice("Naija_Intro-music");

	
	while (dsq->sound->isPlayingVoice())
		dsq->main(FRAME_TIME);

	/*
	while (dsq->sound->isPlayingVoice())
	{
		if (isActing(ACTION_ESC))
		{
			while (isActing(ACTION_ESC) && dsq->sound->isPlayingVoice())
			{
				core->main(FRAME_TIME);
			}
			dsq->overlay->alpha.interpolateTo(1, 1);
			dsq->stopVoice();
			dsq->main(1);
			dsq->newGame();
			return;
		}
		core->main(FRAME_TIME);
	}
	*/

	/*
	Quad *frame3 = new Quad;
	{
		frame3->setTexture("gameover-0002");
		frame3->position = Vector(400,300);
		frame3->width = 600;
		frame3->height = 600;
	}
	addRenderObject(frame3, LR_BACKGROUND);

	Quad *frame2 = new Quad;
	{
		frame2->setTexture("gameover-0003");
		frame2->position = Vector(400,300);
		frame2->width = 600;
		frame2->height = 600;
	}
	addRenderObject(frame2, LR_BACKGROUND);

	Quad *frame1 = new Quad;
	{
		frame1->setTexture("gameover-0004");
		frame1->position = Vector(400,300);
		frame1->width = 600;
		frame1->height = 600;
	}
	addRenderObject(frame1, LR_BACKGROUND);
	*/

	/*
	dsq->voice("Naija_Intro1");
	while (dsq->isStreamingVoice())		core->main(1);
	*/

	/*
	frame1->alpha.interpolateTo(0, 1);
	core->main(1);
	*/

	/*
	dsq->voice("Naija_Intro2");
	while (dsq->isStreamingVoice())		core->main(1);
	*/

	//frame2->alpha.interpolateTo(0, 1);

	/*
	dsq->voice("Naija_Intro3");
	while (dsq->isStreamingVoice())		core->main(1);
	*/

	/*
	frame3->alpha.interpolateTo(0, 1);
	core->main(1);
	*/

	/*
	dsq->voice("Naija_Intro3");
	while (dsq->isStreamingVoice())		core->main(1);
	*/

	//frame4->alpha.interpolateTo(0, 1);

	/*
	dsq->voice("Naija_Intro4");
	while (dsq->isStreamingVoice())		core->main(1);
	*/

	emitter->stop();
	emitter2->start();
	core->main(0.5);
	core->sound->playSfx("NormalForm");
	dsq->overlay->color = Vector(1,1,1);
	dsq->overlay->alpha = 0;
	dsq->fade(1, 1);
	core->main(1);

	frame4->alpha = 0;
	dsq->overlay->color.interpolateTo(0, 1);
	core->main(1);

	dsq->overlay->color = 0;
	dsq->overlay->alpha = 1;

	dsq->setCutscene(0);

	dsq->newGame();
}