예제 #1
0
/*===========================================================================
 *
 * Class CSrEspFile Method - bool Load (pFilename, pCallback);
 *
 * Description
 *
 *=========================================================================*/
bool CSrEspFile::Load (const SSCHAR* pFilename, CSrCallback* pCallback) {
  srtimer_t Timer;  
  bool      Result;

		/* Clear the current object contents */
  Destroy();
  SetFilename(pFilename);
  m_Records.SetParent(this);
  
  SrStartTimer(Timer);

		/* Attempt to load any string files associated with the file */
  Result = LoadStringFiles(pCallback);
  MakeStringMap(pCallback);

  Result = CSrRecord::InitIOBuffers();
  if (!Result) return (false);

  Result = m_File.Open(pFilename, "rb");
  if (!Result) return (false);

  if (pCallback) pCallback->SetLabel("Loading '%s'...", pFilename);

  Result = Read(pCallback);

  SystemLog.Printf("End read position for file '%s' is 0x%08X.", pFilename, m_File.Tell64());
  m_File.Close();

  if (IsLocalStrings())
  {
	  LoadLocalStrings(pCallback);
  }    

  CSrRecord::DestroyIOBuffers();

  SrEndTimer(Timer, "\tLoaded file in");

  return (Result);
}
예제 #2
0
int UI_Startup()
{
	C_Window	*win;
	ImageBuffer *Primary;
	int			i;
	DWORD		r_mask, g_mask, b_mask;

	// OW
	//ShowCursor(TRUE);
	while (ShowCursor(TRUE) < 0);

	// OW
	// SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);

	FalconMessageFilter UIFilter(FalconEvent::UIThread, 0);

	// OW: Enable UI Hardware acceleration
	//	FalconDisplay.EnterMode(FalconDisplayConfiguration::UI);

	// M.N. Large UI
	if (g_bHiResUI){
		FalconDisplay.EnterMode(
			FalconDisplayConfiguration::UILarge, DisplayOptions.DispVideoCard, DisplayOptions.DispVideoDriver
		);
	}
	else {
		FalconDisplay.EnterMode(
			FalconDisplayConfiguration::UI, DisplayOptions.DispVideoCard, DisplayOptions.DispVideoDriver
		);
	}

	Primary=FalconDisplay.GetImageBuffer();

	Primary->GetColorMasks( &r_mask, &g_mask, &b_mask );
	UI95_SetScreenColorInfo(static_cast<DWORD>(r_mask), static_cast<DWORD>(g_mask), static_cast<DWORD>(b_mask));

	UIBuildColorTable();

	if(!gPlayerBook){
		gPlayerBook= new PhoneBook;
		gPlayerBook->Setup();
		gPlayerBook->Load("phonebkn.da2");
	}

	// THESE 2 LINES ARE VERY VERY Important!
	ShowWindow(FalconDisplay.appWin,SW_SHOWNORMAL);
	UpdateWindow(FalconDisplay.appWin);

	if(gScreenShotEnabled)
	{
		if (g_bHiResUI)
			gScreenShotBuffer=new WORD[1024l*768l];
		else
			gScreenShotBuffer=new WORD[800l*600l];
	}

	gMainHandler=new C_Handler;
	gMainHandler->Setup(FalconDisplay.appWin,NULL,Primary);
//	gMainHandler->SetCallback(UIMainMouse);

	GlobalSetup();
	LoadArtwork();
	LoadSoundFiles();
	LoadStringFiles();
	LoadMovieFiles();
	SetStartupFlags();

	LoadMainWindow();
	LoadCommsWindows();
	LoadHelpGuideWindows();
	RealLoadLogbook(); // without daves extra garbage

	_tcscpy(gUI_AutoSaveName,gStringMgr->GetString(TXT_AUTOSAVENAME));


	if(gCommsMgr->Online())
	{
		StartCommsQueue();
		RebuildGameTree();
	}

	INFOSetupControls();

	gMusic=new C_Music;
	gMusic->Setup(gSoundDriver);
	i=0;
	while(IntList[i].MusicID)
	{
		gMusic->AddInteractiveMusic(IntList[i].Section,IntList[i].Group,IntList[i].MusicID);
		i++;
	}

	gMainHandler->SetSection(100);
	if(MainLastGroup)
	{
		// Returning from the sim - Post eval our flight
		// KCK: Added the check for a pilot list so that we don't post-eval after a
		// discarded mission
		if(TheCampaign.MissionEvaluator && TheCampaign.MissionEvaluator->flight_data)
			TheCampaign.MissionEvaluator->PostMissionEval();
	
		if(MainLastGroup == 1000)
		{
			LoadInstantActionWindows();
			gMainHandler->EnableWindowGroup(100);
			gMainHandler->EnableWindowGroup(MainLastGroup);
		}
		else if(MainLastGroup == 2000)
		{
			LoadDogFightWindows();
		}
		else if (MainLastGroup == 3000)
		{
			LoadCampaignSelectWindows();
			restart_tactical_engagement ();
		}
		else if(MainLastGroup == 4000)
		{
			gMainHandler->SetSection(200);
			LoadCampaignSelectWindows();
			SetupMapWindow();
			LoadCampaignWindows();
			CampaignSetup();
			gMainHandler->EnableWindowGroup(200);
			if(CampaignLastGroup)
			{
				win=gMainHandler->FindWindow(CP_TOOLBAR);
				if(win)
					win->UnHideCluster(CampaignLastGroup);
				gMainHandler->EnableWindowGroup(CampaignLastGroup);
			}
			ActivateCampMissionSchedule();

			DoResultsWindows();
			/*
			if(MissionResult & PROMOTION)
				PromotionWindow();
			if(MissionResult & AWARD_MEDAL)
				AwardWindow();
			else if(MissionResult & COURT_MARTIAL)
				CourtMartialWindow();
			*/
			
		}
		else
		{
			gMainHandler->EnableWindowGroup(MainLastGroup);
		}
	}
	else
		gMainHandler->EnableWindowGroup(100);

	if(CampaignLastGroup != 4000)
		PlayUIMusic();

	gSoundMgr->SetAllVolumes(PlayerOptions.GroupVol[UI_SOUND_GROUP]);
	

	gMainHandler->StartTimerThread(UI_TIMER_INTERVAL); // 1 second intervals

	gMainHandler->SetEnableTime(GetCurrentTime()+100);
	gMainHandler->SetDrawFlag(1); // allow drawing (currently a true/false flag)

	UI_VuThread=new VuThread(&UIFilter, F4_EVENT_QUEUE_SIZE);

// Test KLUDGE for speedup
  	DeviceDependentGraphicsSetup( &FalconDisplay.theDisplayDevice );
	//DrawableBSP::LockAndLoad(VIS_F16C);
	
	SetCursor(gCursors[CRSR_F16]);

	if(!(LogState & LB_LOADED_ONCE))
	{
		LogState |= LB_LOADED_ONCE;
		LogBook.Initialize();
		UI_logbk.Initialize();
		PlayerOptions.Initialize ();
		DisplayOptions.Initialize();
	}

	if(!LogBook.CheckPassword(_T("")) && !(LogState & LB_CHECKED))
		PasswordWindow(TXT_LOG_IN,TXT_LOG_IN_MESSAGE,CheckPasswordCB,NoPasswordCB);
	else
	{
		FalconLocalSession->SetPlayerName(LogBook.NameWRank());
		FalconLocalSession->SetPlayerCallsign(LogBook.Callsign());
		FalconLocalSession->SetAceFactor(LogBook.AceFactor());
		FalconLocalSession->SetInitAceFactor(LogBook.AceFactor());
	}

	F4HearVoices();
	UserStickInputs.Reset();

	return(0);
}