void InitApp(UINT dpi) { StartXAudio2(); CHECK_HR(LoadSoundFiles()); CHECK_HR(gpXAudio2->CreateSourceVoice(&gpSourceThunder, &gWfxThunder)); CHECK_HR(gpXAudio2->CreateSourceVoice(&gpSourceCollectible, &gWfxCollectible)); LARGE_INTEGER performanceFrequency, firstFrameTicks; CHECK_WIN32(QueryPerformanceFrequency(&performanceFrequency)); CHECK_WIN32(QueryPerformanceCounter(&firstFrameTicks)); gPerformanceFrequency = performanceFrequency.QuadPart; gLastFrameTicks = firstFrameTicks.QuadPart; gAccumulatedFrameTicks = 0; gpRenderer = std::make_unique<Renderer>(gpDevice.Get(), gpDeviceContext.Get(), gpDxgiDevice.Get(), dpi); gpRenderer->Init(); #define SIM_ORBIT_RADIUS 50.f #define SIM_DISC_RADIUS 12.f auto center = DirectX::XMVectorSet(0.0f, 0.4f*SIM_DISC_RADIUS, 0.0f, 0.0f); auto radius = 35.0f; auto minRadius = SIM_ORBIT_RADIUS - 3.25f * SIM_DISC_RADIUS; auto maxRadius = SIM_ORBIT_RADIUS + 3.0f * SIM_DISC_RADIUS; auto longAngle = 1.50f; auto latAngle = 0.75f; gCamera.View(center, radius, minRadius, maxRadius, longAngle, latAngle); }
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); }