Exemple #1
0
bool GForce::RestoreConfigState( long inParamName ) {
	UtilStr str, configName;
	long pos, n, found = false;

	if ( mPrefs.GetPref( inParamName, str ) ) {

		// Parse the waveshape config name
		pos = str.FindNextInstanceOf( 0, ',' );
		configName.Assign( str.getCStr(), pos - 1 );
		n = mWaveShapes.FetchBestMatch( configName );
		loadWaveShape( n, false );
		mShapeSlideShow = false;

		// Parse the colormap config name
		str.Trunc( pos, false );
		pos = str.FindNextInstanceOf( 0, ',' );
		configName.Assign( str.getCStr(), pos - 1 );
		n = mColorMaps.FetchBestMatch( configName );
		loadColorMap( n, false );
		mColorSlideShow = false;

		// Parse the colormap config name
		str.Trunc( pos, false );
		n = mDeltaFields.FetchBestMatch( str );
		loadDeltaField( n );
		mFieldSlideShow = false;

		found = true;
	}

	return found;
}
Exemple #2
0
void GForce::ManageColorChanges() {
	int i;

	// If in a ColorMap transition/morph
	if ( mColorTransTime > 0 ) {

		// If we've the ColorMap transition is over, end it
		if ( mT_MS > mColorTransEnd ) {
			GF_Palette* temp = mGF_Palette;
			mGF_Palette = mNextPal;
			mNextPal = temp;
			mColorTransTime = -1;
			mNextColorChange = mT + mColorInterval.Evaluate();
		}
	}

	// Time for a color map change?
	else if ( mT > mNextColorChange && mColorSlideShow ) {

		// Load the next config in the (randomized) config list...
		i = mColorPlayList.FindIndexOf( mCurColorMapNum );

		// Make a new play list if we've reached the end of the list...
		if ( i >= mColorPlayList.Count() ) {
			mColorPlayList.Randomize();
			i = 0;
		}
		loadColorMap( mColorPlayList.Fetch( i + 1 ), true );
	}

	// Update the screen palette if it's time
	if ( mT > mNextPaletteUpdate ) {

		// If in a ColorMap transition/morph then we must set mColorTrans, for it's linked into mGF_Palette
		if ( mColorTransTime > 0 ) {
			float t = (float) ( mColorTransEnd - mT_MS ) / ( (float) mColorTransTime );
			mColorTrans = pow( t, TRANSITION_ALPHA );
		}

		// Evaluate the palette at this time
		mGF_Palette -> Evaluate( mPalette );

		// Set our offscreen ports to the right palette...
		mPortA.SetPalette( mPalette );
		mPortB.SetPalette( mPalette );

		// If we're at fullsceen, the screen device may need the current palette too
		if ( mAtFullScreen && mFullscreenDepth == 8 ) {
			mScreen.SetPalette( mPalette );
			mPortA.PreventActivate( mOutPort );
			mPortB.PreventActivate( mOutPort );
		}

		// Reevaluate the palette a short time from now
		mNextPaletteUpdate = mT + .1;
	}
}
void init()
{
	sx = sy = sz = 1;
	coloredVolume.resize(4);
	curDataIdx = 0;
	curResLevel = 0;

	colorMap = loadColorMap(0);
	coloredVolume = loadVolume(curDataIdx, curResLevel);

	printHelp();

	initDisp();
}
Exemple #4
0
bool GForce::HandleKey( long inChar ) {
	bool handled = true;
	int n;

	// See if this keystroke is to be ignored
	if ( ! mHandleKeys )
		return false;


	if ( inChar >= 'a' && inChar <= 'z' )
		inChar = 'A' + ( inChar - 'a' );

	if ( inChar == '/' || inChar == '?' )
		ShowHelp();
	else if ( inChar >= ' ' && inChar < 129 ) {

		inChar = mKeyMap.FindNextInstanceOf( 0, inChar );

		switch ( inChar ) {

		case cDispTrackTitle:
			StartTrackText();
			break;

		case cGetConfigInfo:
		  {
			Print(_("WaveShape:  "));
			Println( &mWaveShapeName );
			Print(_("ColorMap:   "));
			Println( &mColorMapName );
			Print(_("DeltaField: "));
			Println( mField -> GetName() );
			ParticleGroup* particle = (ParticleGroup*) mRunningParticlePool.GetHead();
			if ( particle ) {
				Print(_("Particles:  "));

				while ( particle ) {
					Print( &particle -> mTitle );
					particle = (ParticleGroup*) particle -> GetNext();
					if ( particle )
						Print( ", " );
				}
				Println( "" );
			}
			break;
		  }
		case cFrameRate:
			mTemp.SetFloatValue( ( (float) mCurFrameRate ) / 10.0 );
			mTemp.Append(_(" frames/sec"));
			Println( &mTemp );
			break;

		case cDecMagScale:
			mMagScale /= 1.2;
			mTemp.SetFloatValue( mMagScale );
			Print(_("Amplitude scale: "));
			Println( &mTemp );
			break;

		case cIncMagScale:
			mMagScale *= 1.2;
			mTemp.SetFloatValue( mMagScale );
			Print(_("Amplitude scale: "));
			Println( &mTemp );
			break;

		case cToggleParticles:
			mParticlesOn = ! mParticlesOn;
			if ( mParticlesOn )
				Println(_("Particles ON"));
			else
				Println(_("Particles OFF"));
			break;

		case cSpawnNewParticle:
			SpawnNewParticle();
			break;

		case cDecNumSSteps:
		case cIncNumSSteps:
			if ( inChar == cDecNumSSteps )
				n = - 4;
			else
				n = + 4;
			SetNumSampleBins( mNum_S_Steps + n );
			mTemp.Assign(_("Number s steps: "));
			mTemp.Append( mNum_S_Steps );
			Println( &mTemp );
			break;

		case cToggleConfigName:
			mNewConfigNotify = ! mNewConfigNotify;
			if ( mNewConfigNotify )
				Println(_("Show names ON"));
			else
				Println(_("Show names OFF"));
			break;

		case cToggleNormalize:
			mNormalizeInput = ! mNormalizeInput;
			if ( mNormalizeInput )
				Println(_("Normalize ON"));
			else
				Println(_("Normalize OFF"));
			break;

		case cPrevDeltaField:
		case cNextDeltaField:
			n = mFieldPlayList.FindIndexOf( mCurFieldNum );
			if ( inChar == cPrevDeltaField )
				n = n + mFieldPlayList.Count() - 2;

			loadDeltaField( mFieldPlayList.Fetch( 1 + n % mFieldPlayList.Count() ) );

			// If the pref says so, display that we're loading a new config
			if ( mNewConfigNotify ) {
				Print(_("Loading DeltaField: "));
				Println( mField -> GetName() );
			}

			// Turn field slide show off when we change deltafields manually
			if ( ! mFieldSlideShow )
				break;
		case cToggleFieldShow:
			mFieldSlideShow = ! mFieldSlideShow;
			mNextFieldChange = mT;
			if ( mFieldSlideShow ) {
				Println(_("DeltaField slideshow ON"));
				mFieldPlayList.Randomize(); }
			else
				Println(_("DeltaField slideshow OFF"));
			break;


		case cStartSlideshowAll:
			mFieldSlideShow = true;		mNextFieldChange = mT;
			mColorSlideShow = true;		mNextColorChange = mT;
			mShapeSlideShow = true;		mNextShapeChange = mT;
			Println(_("All slideshows ON"));
			break;

		case cStopSlideshowAll:
			mFieldSlideShow = false;
			mColorSlideShow = false;
			mShapeSlideShow = false;
			Println(_("All slideshows OFF"));
			break;


		case cPrevColorMap:
		case cNextColorMap:
			n = mColorPlayList.FindIndexOf( mCurColorMapNum );
			if ( inChar == cPrevColorMap )
				n = n + mColorPlayList.Count() - 2;

			loadColorMap( mColorPlayList.Fetch( 1 + n % mColorPlayList.Count() ), false );

			// Turn slide show off when we change colormaps manually
			if ( ! mColorSlideShow )
				break;
		case cToggleColorShow:
			mColorSlideShow = ! mColorSlideShow;
			mNextColorChange = mT;
			if ( mColorSlideShow ) {
				Println(_("ColorMap slideshow ON"));
				mColorPlayList.Randomize(); }
			else
				Println(_("ColorMap slideshow OFF"));
			break;

		case cPrevWaveShape:
		case cNextWaveShape:
			n = mShapePlayList.FindIndexOf( mCurShapeNum );
			if ( inChar == cPrevWaveShape )
				n = n + mShapePlayList.Count() - 2;

			loadWaveShape( mShapePlayList.Fetch( 1 + n % mShapePlayList.Count() ), false );

			// Turn slide show off when we change shapes manually
			if ( ! mShapeSlideShow )
				break;
		case cToggleShapeShow:
			mShapeSlideShow = ! mShapeSlideShow;
			mNextShapeChange = mT;
			if ( mShapeSlideShow ) {
				Println(_("WaveShape slideshow ON"));
				mShapePlayList.Randomize(); }
			else
				Println(_("WaveShape slideshow OFF"));
			break;

		case cSetPreset0:	StoreConfigState( VAL('S','E','T','0') );	break;
		case cSetPreset1:	StoreConfigState( VAL('S','E','T','1') );	break;
		case cSetPreset2:	StoreConfigState( VAL('S','E','T','2') );	break;
		case cSetPreset3:	StoreConfigState( VAL('S','E','T','3') );	break;
		case cSetPreset4:	StoreConfigState( VAL('S','E','T','4') );	break;
		case cSetPreset5:	StoreConfigState( VAL('S','E','T','5') );	break;
		case cSetPreset6:	StoreConfigState( VAL('S','E','T','6') );	break;
		case cSetPreset7:	StoreConfigState( VAL('S','E','T','7') );	break;
		case cSetPreset8:	StoreConfigState( VAL('S','E','T','8') );	break;
		case cSetPreset9:	StoreConfigState( VAL('S','E','T','9') );	break;


		case cPreset0:	handled = RestoreConfigState( VAL('S','E','T','0') );	break;
		case cPreset1:	handled = RestoreConfigState( VAL('S','E','T','1') );	break;
		case cPreset2:	handled = RestoreConfigState( VAL('S','E','T','2') );	break;
		case cPreset3:	handled = RestoreConfigState( VAL('S','E','T','3') );	break;
		case cPreset4:	handled = RestoreConfigState( VAL('S','E','T','4') );	break;
		case cPreset5:	handled = RestoreConfigState( VAL('S','E','T','5') );	break;
		case cPreset6:	handled = RestoreConfigState( VAL('S','E','T','6') );	break;
		case cPreset7:	handled = RestoreConfigState( VAL('S','E','T','7') );	break;
		case cPreset8:	handled = RestoreConfigState( VAL('S','E','T','8') );	break;
		case cPreset9:	handled = RestoreConfigState( VAL('S','E','T','9') );	break;

		default:
			handled = false;
		}	}
	else
		handled = false;

	return handled;
}