Exemplo n.º 1
0
void LogisticsSaveDialog::beginLoad()
{
	beginFadeIn( 0 );
	edits[0].setFocus(true);
	initDialog(savePath, 0);
	status = RUNNING;
	bPromptOverwrite = 0;
	bDeletePrompt = 0;
	bLoad = 1;
	bCampaign = 0;

	// need to change all the texts...
	textObjects[0].setText( IDS_DIALOG_LOAD_GAME );
	textObjects[1].setText( IDS_DIALOG_GAME_LIST );
	textObjects[2].setText( "" );

	buttons[2].setText( IDS_LOAD );

	edits[0].setEntry( "" );
	edits[0].limitEntry( 20 );

	
	aListItem* pItem = gameListBox.GetItem( 0 );
	if ( pItem )
	{
		pItem->select();
		edits[0].setEntry( ((aTextListItem*)pItem)->getText() );
		selectedName = ( ((aLocalizedListItem*)pItem)->getHiddenText() );
	}

	updateMissionInfo();

	LogisticsDialog::begin();

}
Exemplo n.º 2
0
void MPConnectionType::render(int xOffset, int yOffset )
{
	LogisticsScreen::render(xOffset, yOffset);

	if ((0 == xOffset) && (0 == yOffset))
	{
		if (pPanel)
		{
			pPanel->render(xOffset, yOffset);
		}
	}
	else // if scrolling, make sure we don't fade
		beginFadeIn( 0 );

	if ( bHosting )
		hostDlg.render();
}
Exemplo n.º 3
0
void MPConnectionType::begin()
{
	status = RUNNING;
	beginFadeIn( 1.0 );
	bHosting = 0;

	if ( MPlayer )
	{
		MPlayer->closeSession();

		if ( !MPlayer->getOnLAN() )
		{
			getButton( FIRST_BUTTON_ID+2 )->disable( true );
		}
		else
		{
			getButton( FIRST_BUTTON_ID+2 )->disable( false );
		}
	}

	tcpipPanel.begin();
}
Exemplo n.º 4
0
void MainMenu::update()
{

	if ( bDrawBackground || MPlayer || LogisticsData::instance->isSingleMission() )
	{
		getButton( MM_MSG_SAVE )->disable( true );
	}
	else
		getButton( MM_MSG_SAVE )->disable( false );

	getButton( MM_MSG_MULTIPLAYER )->disable( true );

	if ( introMovie )
	{
		userInput->mouseOff();

		if (userInput->getKeyDown(KEY_SPACE) || userInput->getKeyDown(KEY_ESCAPE) || userInput->getKeyDown(KEY_LMOUSE))
		{
			introMovie->stop();
		}

		bool result = introMovie->update();
		if (result)
		{
			
			//Movie's Over.
			//Whack it.
			delete introMovie;
			introMovie = NULL;
		}

		return;
	}

	if (!musicStarted)
	{
		musicStarted = true;
		soundSystem->setMusicVolume( prefs.MusicVolume );
		soundSystem->playDigitalMusic(tuneId);
	}

	if ( endAnim.isDone() )
	{
		status = endResult;
	}

	if ( bDrawMechlopedia )
	{
		mechlopedia->update();
		if ( mechlopedia->getStatus() == NEXT )
		{
			beginFadeIn( 0 );
			bDrawMechlopedia = 0;
			if ( !bDrawBackground )
				status = NEXT;
		}
		return;
	}

	if ( bOptions )
	{
		OptionsScreenWrapper::status_type result = optionsScreenWrapper->update();
		if (result == OptionsScreenWrapper::opt_DONE)
		{
			optionsScreenWrapper->end();
			bOptions = 0;
		}

		return;
	}

	if ( (bSave || bLoad || bLoadCampaign) && endAnim.isDone() )
	{
		LogisticsSaveDialog::instance()->update();

		if ( LogisticsSaveDialog::instance()->getStatus() == LogisticsScreen::YES 
			&& LogisticsSaveDialog::instance()->isDone() )
		{
			
			char name[1024];
			strcpy( name, savePath );
			strcat( name, LogisticsSaveDialog::instance()->getFileName() );
			int index = strlen( name ) - 4;
			if ( _stricmp( &name[index], ".fit" ) !=0 ) 
				strcat( name, ".fit" );

			
			FitIniFile file;
			if ( bSave )
			{
				// make sure the save game directory exists, if not create it
				CreateDirectory( savePath, NULL );

				if ( NO_ERR != file.createWithCase( name ) )
				{
					char errorStr[1024];
					sprintf( errorStr, "couldn't open the file %s", name );
					Assert( 0, 0, errorStr );
				}
				else
				{
					LogisticsData::instance->save( file );
					LogisticsSaveDialog::instance()->end();
					file.close();
				}
				bSave = bLoad = 0;
				status = NEXT;
				

			}
			else if ( bLoadCampaign )
			{
				LogisticsData::instance->startNewCampaign( LogisticsSaveDialog::instance()->getFileName());
				status = endResult = RESTART;
//				background.beginFadeOut( 1.0f );
//				beginFadeOut( 1.0f );
				bLoadCampaign = 0;
			}
			else
			{
				if ( NO_ERR != file.open( name ) )
				{
					char errorStr[1024];
					sprintf( errorStr, "couldn't open the file %s", name );
					Assert( 0, 0, errorStr );
				}
				else
					LogisticsData::instance->load( file );
				LogisticsSaveDialog::instance()->end();
				bSave = bLoad = 0;
				status = RESTART;
				file.close();

			}
		}
		else if ( LogisticsSaveDialog::instance()->getStatus() == LogisticsScreen::NO &&
			LogisticsSaveDialog::instance()->isDone())
		{
			LogisticsSaveDialog::instance()->end();
			bSave = bLoad = bLoadCampaign = 0 ;
			if ( !bDrawBackground )
				status = NEXT;
			else
			{
				beginAnim.begin();
				endAnim.end();
			}
		}
		return;
	}
	else if ( bLoadSingle && endAnim.isDone())
	{
		singleLoadDlg.update();
		if ( singleLoadDlg.isDone() )
		{
			if ( singleLoadDlg.getStatus() == YES )
			{
				const char* pName = singleLoadDlg.getMapFileName();
				if (pName)
				{
					LogisticsData::instance->setSingleMission( pName );
					status = SKIPONENEXT;
				}
			}

			bLoadSingle = 0;
			beginAnim.begin();
			endAnim.end();
		}
	}

	else if ( promptToQuit )
	{
		LogisticsOKDialog::instance()->update();
		{
			if ( LogisticsOKDialog::instance()->getStatus() == LogisticsScreen::YES )
			{
				soundSystem->playDigitalSample( LOG_EXITGAME );
				gos_TerminateApplication();
				promptToQuit = 0;

			}
			else if ( LogisticsOKDialog::instance()->getStatus() == LogisticsScreen::NO)
			{
				if ( LogisticsOKDialog::instance()->isDone() )
					promptToQuit = 0;
			}

			

		}
	}
	else if ( bLegal )
	{
		LogisticsLegalDialog::instance()->update();
		if ( LogisticsLegalDialog::instance()->isDone() )
		{
			LogisticsLegalDialog::instance()->end();
			bLegal = 0;
		}
	}
	else if ( bHostLeftDlg )
	{
		LogisticsOneButtonDialog::instance()->update();
		if ( LogisticsOneButtonDialog::instance()->isDone() )
		{
			LogisticsOneButtonDialog::instance()->end();
			bHostLeftDlg = 0;
		}

		if ( MPlayer ) // has to be done, but can't be done when initialized
		{
			MPlayer->closeSession();
			delete MPlayer;
			MPlayer = NULL;
		}
	}
	else if ( promptToDisconnect )
	{
		LogisticsOKDialog::instance()->update();
		if ( LogisticsOKDialog::instance()->isDone() )
		{
			if ( YES == LogisticsOKDialog::instance()->getStatus() )
			{
				if ( MPlayer )
				{
					MPlayer->closeSession();
					delete MPlayer;
					MPlayer = NULL;
				}
				long oldRes = endResult;
				endResult = 0;

				handleMessage( oldRes, oldRes );

				setDrawBackground( true );
			}
			else
				handleMessage( NEXT, NEXT );
			
			promptToDisconnect = 0;
		}
	}
	else
	{
		if ( bDrawBackground  )
		{
			if ( !intro.animObjects[0].isDone() )
			{
				intro.update();
				background.update();
				if (userInput->getKeyDown(KEY_ESCAPE) || (Environment.Renderer == 3))
				{
					introOver = true;
					userInput->mouseOn();
					soundSystem->playDigitalSample( LOG_MAINMENUBUTTON );

				}
				else if ( !introOver )
					return;
			}
			else
			{
				background.update();
				if ( !introOver )
					soundSystem->playDigitalSample( LOG_MAINMENUBUTTON );

				introOver = true;
				userInput->mouseOn();

			}
		}

		beginAnim.update();
		endAnim.update();

		LogisticsScreen::update();
		if ( (!bLoadSingle) && userInput->isLeftClick() && !inside( userInput->getMouseX(), userInput->getMouseY() ) )
		{
			handleMessage( 0, MM_MSG_RETURN_TO_GAME );
		}
	}
}
Exemplo n.º 5
0
void MainMenu::begin()
{
	status = RUNNING;
	promptToQuit = 0;
	beginAnim.begin();
	beginFadeIn( 0 );
	endAnim.end();
	background.beginFadeIn( 0 );
	endResult = RUNNING;
	musicStarted = false;
	bLoadSingle = 0;
	bLoadCampaign = 0;
	promptToDisconnect = 0; 
	bLegal = 0;

	// no host left dlg, sometimes we get this begin call 2x's due to netlib weirdness
	if ( !introMovie )
	{
			while (mc2IsInMouseTimer)
				;

			//ONLY set the mouse BLT data at the end of each update.  NO MORE FLICKERING THEN!!!
			// BLOCK THREAD WHILE THIS IS HAPPENING
			mc2IsInDisplayBackBuffer = true;

			mc2UseAsyncMouse = prefs.asyncMouse;
			if ( !mc2UseAsyncMouse)
				MouseTimerKill();

			mc2IsInDisplayBackBuffer = false;

			AsynFunc = NULL;

			//Force mouse Cursors to smaller or larger depending on new video mode.
			userInput->initMouseCursors("cursors");
			userInput->mouseOn();
			userInput->setMouseCursor( mState_LOGISTICS );

			DWORD localRenderer = prefs.renderer;
			if (prefs.renderer != 0 && prefs.renderer != 3)
				localRenderer = 0;

   			bool localFullScreen = prefs.fullScreen;
   			bool localWindow = !prefs.fullScreen;
   			if (Environment.fullScreen && prefs.fullScreen)
   				localFullScreen = false;


			// make sure we get into 800 x 600 mode
			if ( Environment.screenWidth != 800 )
			{
			
				if (prefs.renderer == 3)
					gos_SetScreenMode(800,600,16,0,0,0,true,localFullScreen,0,localWindow,0,localRenderer);
				else
					gos_SetScreenMode(800,600,16,prefs.renderer,0,0,0,localFullScreen ,0,localWindow,0,localRenderer);
			}


	}
}
void PilotReviewScreen::init(FitIniFile* file)
{
	LogisticsScreen::init( *file, "PilotReviewStatic", 
		"PilotReviewText", "PilotReviewRect", "PilotReviewButton" );

	file->seekBlock( "PilotReviewMisc" );
	long tmp;
	file->readIdLong( "PilotReviewSmallSkip", tmp );

	pilotListBox.setSpaceBetweenItems( tmp );
		
	long color, font;
	file->readIdLong( "color", color );
	file->readIdLong( "font", font );
	
	pilotListBox.init( rects[0].left(), rects[0].top(), 
						rects[0].width(), rects[0].height() );

	DeadPilotListItem::init( file );

	ActivePilotListItem::init( file );

	ActivePilotListItem::s_totalWidth = pilotListBox.width() - 70;

	long count = LogisticsData::instance->getPilotCount();
	LogisticsPilot** pPilots = (LogisticsPilot**)_alloca( count * sizeof(LogisticsPilot*) );
	LogisticsData::instance->getPilots( pPilots, count );


	bool bDeadTextAdded = 0;

	bool bFirst = 0;
	for ( int i = 0; i < count; i++ )
	{
		if ( pPilots[i]->justDied() && pPilots[i]->isUsed() )
		{
			if ( !bDeadTextAdded )
			{
				aTextListItem* pItem = new aTextListItem( font );
				pItem->setText( IDS_KILLED_IN_ACTION );
				pItem->setColor( color ) ;

				pilotListBox.AddItem( pItem );
				bDeadTextAdded = true;
			}


			DeadPilotListItem* pItem = new DeadPilotListItem( pPilots[i] );
			if ( !bFirst )
			{
				pItem->begin();
				pItem->showGUIWindow(0);
			}
			bFirst = 1;
			pilotListBox.AddItem( pItem );
		}
	}

	if ( bDeadTextAdded )
	{

		aTextListItem* pItem = new aTextListItem( font );
		pItem->setText( "" );
		pItem->setColor( color ) ;
		pilotListBox.AddItem( pItem );
	}


	
	bool bLiveTextAdded = 0;
	bool bJustPromoted = 0;

	for ( i = 0; i < count; i++ )
	{
		if ( !pPilots[i]->isDead() && pPilots[i]->isUsed() )
		{
			if ( !bLiveTextAdded )
			{
				aTextListItem* pItem = new aTextListItem( font );
				pItem->setText( IDS_ACTIVE_DUTY );
				pItem->setColor( color ) ;
				long oldHeight = pItem->height();
				pItem->resize( pItem->width(), oldHeight + 20 );
				if ( bDeadTextAdded )
					pItem->showGUIWindow( 0 );
				pilotListBox.AddItem( pItem );
				bLiveTextAdded = true;
			}

			ActivePilotListItem* pItem = new ActivePilotListItem( pPilots[i] );
			pilotListBox.AddItem( pItem );
			if ( pPilots[i]->promotePilot() )
				bJustPromoted = true;
		}
	}

	entryAnim.initWithBlockName( file, "PilotAreaBeginAnimation" );
	entryAnim.begin();

	exitAnim.initWithBlockName( file, "PilotReviewFadeOutAnimation" );


	beginFadeIn( 0 );
	gosASSERT( rects ); // need this for the list box

	if ( bJustPromoted ) // disable done button if promotion is going to happen
		buttons[0].disable( true );

	
}