コード例 #1
0
PaletteFaderProcess::PaletteFaderProcess(Pentagram::PalTransforms trans,
		int priority_, int frames) : priority(priority_), 
		counter(frames), max_counter(frames)
{
	PaletteManager	*pm = PaletteManager::get_instance();
	Pentagram::Palette *pal = pm->getPalette(PaletteManager::Pal_Game);
	for (int i = 0; i < 12; i++) old_matrix[i] = pal->matrix[i];
	pm->getTransformMatrix(new_matrix,trans);
	pal->transform = trans;
}
コード例 #2
0
ファイル: Game.cpp プロジェクト: amichaelt/pentagram
uint32 Game::I_playEndgame(const uint8* args, unsigned int /*argsize*/)
{
	SettingManager* settingman = SettingManager::get_instance();
	settingman->set("endgame", true);
	settingman->write();

	PaletteManager* palman = PaletteManager::get_instance();
	palman->untransformPalette(PaletteManager::Pal_Game);

	Process* menuproc = new MainMenuProcess();
	Kernel::get_instance()->addProcess(menuproc);

	ProcId moviepid = Game::get_instance()->playEndgameMovie();
	Process* movieproc = Kernel::get_instance()->getProcess(moviepid);
	if (movieproc) {
		menuproc->waitFor(movieproc);
	}

	return 0;
}
コード例 #3
0
PaletteFaderProcess::PaletteFaderProcess(uint32 col32, bool from,
		int priority_, int frames, bool current) : priority(priority_), 
		counter(frames), max_counter(frames)
{
	PaletteManager	*pm = PaletteManager::get_instance();
	Pentagram::Palette *pal = pm->getPalette(PaletteManager::Pal_Game);
	if (!from)
	{
		if (current)
			for (int i = 0; i < 12; i++) old_matrix[i] = pal->matrix[i];
		else
			pm->getTransformMatrix(old_matrix,pal->transform);
		pm->getTransformMatrix(new_matrix,col32);
	}
	else
	{
		pm->getTransformMatrix(old_matrix,col32);
		if (current)
			for (int i = 0; i < 12; i++) new_matrix[i] = pal->matrix[i];
		else
			pm->getTransformMatrix(new_matrix,pal->transform);
	}
}
コード例 #4
0
/*****************************************************
**
**   BasicVedicChart   ---   paintInternal
**
******************************************************/
void BasicVedicChart::paintInternal( ChartConfig *cfg )
{
	wxArrayInt a;
	BgPalette *palette = (BgPalette*)NULL;

	//printf( "BasicVedicChart::paintInternal markedField %d\n", markedField );

	assert( cfg );
	VedicChartConfig *vconf = getVChartConfig();

	// paint field backgrounds if fields are not marked or zoomed
	if ( ! vconf->palette.IsEmpty() )
	{
		PaletteManager *man = PaletteManager::get();
		palette = man->getPalette( vconf->palette );
		if ( palette )
		{
			painter->setTransparentPen();
			for ( uint i = 0; i < field_count; i++ )
			{
				if (( markedField == i ) && ( markedFieldStatus & CHART_FIELD_STATUS_MARKUP || markedFieldStatus & CHART_FIELD_STATUS_ZOOM )) continue;
				painter->setBrush( palette->getBrush( i ));
				paintField( i );
			}
		}
		else
		{
			wxLogError( wxT( "no palette named '%s', referenced in config named '%s'" ), vconf->palette.c_str(), vconf->name.c_str() );
		}
	}

	setDefaultTextColor();

  painter->setPen( vconf->pen.IsOk() ? vconf->pen : defaultPen  );
	painter->setDefaultBrush();
	drawGrid();
	paintOuterRectangle();

	// draw markup resp. zoomed fields
  painter->setPen( vconf->pen.IsOk() ? vconf->pen : defaultPen  );
	for ( uint i = 0; i < field_count; i++ )
	{
		if (( markedField == i ) && ( markedFieldStatus & CHART_FIELD_STATUS_MARKUP
			|| markedFieldStatus & CHART_FIELD_STATUS_ZOOM  ))
		{

			// geht nicht wenn background gesetzt ist 
			if ( markedFieldStatus & CHART_FIELD_STATUS_MARKUP )
			{
				painter->setBrush( config->colors->chartMarkupBgColor );
			}
			else if ( isChartFieldMarked( i ))
			{
				if ( vconf->markedFields.brush.IsOk() ) painter->setBrush( vconf->markedFields.brush );
				else painter->setBrush( config->colors->sbcMarkedFieldsBgColor );
			}
			else if ( palette )
			{
				painter->setBrush( palette->getBrush( i ));
			}
			else
			{
				// background must be painted inorder to overrride other fields
				//GcWidgetBackground *bg = &vconf->widgetBackground;
				if ( vconf->brush.IsOk() )
				{
					painter->setBrush( vconf->brush );
				}
				else
				{
					painter->setDefaultBrush();
				}
			}
			paintField( i );
		}
	}

	// Draw text items
	for ( uint i = 0; i < field_count; i++ )
	{
		if ( h1set && ! h2set )
		{
			drawFieldText( i, FP_ALL );
		}
		else
		{
			if ( h1set ) drawFieldText( i, FP_INNER );
			if ( h2set ) drawFieldText( i, FP_OUTER );
		}
	}

	// additional rectangle separating the chart
	if ( h1set && h2set )
	{
		painter->setTransparentBrush();

		// maybe Nil in case of SBC
		if ( ! transitrect.isNil() ) painter->drawRectangle( transitrect );
	}

	/*
	printf( "\nmarkedField %d markedFieldStatus CHART_FIELD_STATUS_POS_FULL %d\n", markedField, markedFieldStatus & CHART_FIELD_STATUS_POS_FULL );
	printf( "markedField %d markedFieldStatus CHART_FIELD_STATUS_POS_INNER %d\n", markedField, markedFieldStatus & CHART_FIELD_STATUS_POS_INNER );
	printf( "markedField %d markedFieldStatus CHART_FIELD_STATUS_POS_OUTER %d\n\n", markedField, markedFieldStatus & CHART_FIELD_STATUS_POS_OUTER );
	*/

	if ( markedFieldStatus & CHART_FIELD_STATUS_ALL_ASPECTS )
	{
		for( uint j = 0; j < field_count; j++ )
		{
			for( uint target = 0; target < field_count; target++ )
			{
				paintAspectsForFieldPair( j, target );
			}
		}
	}
	else
	{
		for( uint j = 0; j < field_count; j++ )
		{
			//printf( "markedField %d j %d markedFieldStatus %d\n", markedField, j, markedFieldStatus );
			if (( markedField == j ) && ( markedFieldStatus & CHART_FIELD_STATUS_ASPECTED ))
			{
				for( uint target = 0; target < field_count; target++ )
				{
					paintAspectsForFieldPair( a_red( j + positionOffset, field_count ), target );
				}
			}

			// TODO der unterstützt nicht mehrfache Aspekte nebeneinander
			if (( markedField == j ) && ( markedFieldStatus & CHART_FIELD_STATUS_ASPECTING ))
			{
				for(  int source = 0; source < (int)field_count; source++ )
				{
					paintAspectsForFieldPair( source, a_red( j + positionOffset, field_count ) );
				}
			}
		}
	}
	finishChart();
}
コード例 #5
0
ファイル: SKFPlayer.cpp プロジェクト: amichaelt/pentagram
void SKFPlayer::run()
{
	if (!playing || !buffer) return;

	// if doing something, continue
	if (curaction) {
		if (curaction == SKF_FadeOut || curaction == SKF_FadeWhite) {
			fadelevel++;
			if (fadelevel == FADESTEPS) curaction = 0; // done
		} else if (curaction == SKF_FadeIn) {
			fadelevel--;
			if (fadelevel == 0) curaction = 0; // done
		} else {
			pout << "Unknown fade action: " << curaction << std::endl;
		}
	}

	// CHECKME: this timing may not be accurate enough...
	uint32 now = SDL_GetTicks();
	if (lastupdate + (1000/framerate) > now) return;

	lastupdate += (1000/framerate);

	// if waiting, continue to wait
	if (timer) {
		timer--;
		return;
	}

	Pentagram::Font* redfont;
	redfont = FontManager::get_instance()->getGameFont(6, true);

	MusicProcess* musicproc = MusicProcess::get_instance();
	AudioProcess* audioproc = AudioProcess::get_instance();

	// handle events for the current frame
	while (curevent < events.size() && events[curevent]->frame <= curframe) {
//		pout << "event " << curevent << std::endl;
		switch (events[curevent]->action)
		{
		case SKF_FadeOut:
			curaction = SKF_FadeOut;
			fadecolour = 0;
			fadelevel = 0;
//			pout << "FadeOut" << std::endl;
			break;
		case SKF_FadeIn:
			curaction = SKF_FadeIn;
			fadelevel = FADESTEPS;
//			pout << "FadeIn" << std::endl;
			break;
		case SKF_FadeWhite:
			curaction = SKF_FadeWhite;
			fadecolour = 0xFF;
			fadelevel = 0;
//			pout << "FadeWhite" << std::endl;
			break;
		case SKF_Wait:
//			pout << "Wait " << events[curevent]->data << std::endl;
			timer = events[curevent]->data;
			curevent++;
			return;
		case SKF_PlayMusic:
//			pout << "PlayMusic " << events[curevent]->data << std::endl;
			if (musicproc) musicproc->playMusic(events[curevent]->data);
			break;
		case SKF_SlowStopMusic:
			POUT ("SlowStopMusic");
			if (musicproc && !introMusicHack) musicproc->playMusic(0);
			break;
		case SKF_PlaySFX:
//			pout << "PlaySFX " << events[curevent]->data << std::endl;
			if (audioproc) audioproc->playSFX(events[curevent]->data,0x60,0,0);
			break;
		case SKF_StopSFX:
//			pout << "StopSFX" << events[curevent]->data << std::endl;
			if (audioproc) audioproc->stopSFX(events[curevent]->data,0);
			break;
		case SKF_SetSpeed:
			POUT("SetSpeed " << events[curevent]->data);
//			framerate = events[curevent]->data;
			break;
		case SKF_PlaySound:
		{
//			pout << "PlaySound " << events[curevent]->data << std::endl;

			if (audioproc) {
				uint8* buffer = skf->get_object(events[curevent]->data);
				uint32 bufsize = skf->get_size(events[curevent]->data);
				Pentagram::AudioSample* s;
				uint32 rate = buffer[6] + (buffer[7]<<8);
				bool stereo = (buffer[8] == 2);
				s = new Pentagram::RawAudioSample(buffer+34, bufsize-34,
												  rate, true, stereo);
				audioproc->playSample(s, 0x60, 0);
				// FIXME: memory leak! (sample is never deleted)
			}

			// subtitles
			char* textbuf = reinterpret_cast<char*>(
				skf->get_object(events[curevent]->data-1));
			uint32 textsize = skf->get_size(events[curevent]->data-1);
			if (textsize > 7) {
				std::string subtitle = (textbuf+6);
				delete subs;
				subtitley = textbuf[4] + (textbuf[5]<<8);
				unsigned int remaining;
				subs = redfont->renderText(subtitle, remaining, 200, 0,
										   Pentagram::Font::TEXT_CENTER);
			}
			delete textbuf;


			break;
		}
		case SKF_ClearSubs:
//			pout << "ClearSubs" << std::endl;
			delete subs;
			subs = 0;
			break;
		default:
			pout << "Unknown action" << std::endl;
			break;
		}

		curevent++;
	}

	curframe++;

	PaletteManager* palman = PaletteManager::get_instance();
	IDataSource* object;

	uint16 objecttype = 0;
	do {
		curobject++;
		if (curobject >= skf->getCount()) {
			stop(); // done
			return;
		}

		// read object
		object = skf->get_datasource(curobject);
		if (!object || object->getSize() < 2)
			continue;

		objecttype = object->read2();

//		pout << "Object " << curobject << "/" << skf->getCount()
//			 << ", type = " << objecttype << std::endl;


		if (objecttype == 1) {
			palman->load(PaletteManager::Pal_Movie, *object);
		}

		if (objecttype != 2)
			delete object;

	} while (objecttype != 2);

	if (objecttype == 2) {
		object->seek(0);
		Shape* shape = new Shape(object, &U8SKFShapeFormat);
		Pentagram::Palette* pal= palman->getPalette(PaletteManager::Pal_Movie);
		shape->setPalette(pal);
		buffer->BeginPainting();
		buffer->Paint(shape, 0, 0, 0);
		buffer->EndPainting();
		delete shape;
	
		delete object;
	}

	timer = 1; // HACK! timing is rather broken currently...
}