Esempio n. 1
0
void
CmpSceneDlg::Show()
{
    FormWindow::Show();

    Starshatter* stars = Starshatter::GetInstance();

    if (stars->InCutscene()) {
        Sim* sim = Sim::GetSim();

        if (sim) {
            cam_view->UseCamera(CameraDirector::GetInstance()->GetCamera());
            cam_view->UseScene(sim->GetScene());
        }

        // initialize lens flare bitmaps:
        if (stars->LensFlare()) {
            cam_view->LensFlareElements(flare1, flare4, flare2, flare3);
            cam_view->LensFlare(true);
        }

        // if lens flare disabled, just create the corona:
        else if (stars->Corona()) {
            cam_view->LensFlareElements(flare1, 0, 0, 0);
            cam_view->LensFlare(true);
        }

        if (disp_view) {
            old_disp_win = disp_view->GetWindow();

            disp_view->SetWindow(mov_scene);
            mov_scene->AddView(disp_view);
        }

        if (subtitles_box) {
            subtitles_box->SetText(stars->GetSubtitles());
            subtitles_delay = 0;
            subtitles_time  = 0;
        }
    }
}
void
CmdIntelDlg::ExecFrame()
{
	CmdDlg::ExecFrame();

	if (campaign != Campaign::GetCampaign() || campaign->GetUpdateTime() != update_time) {
		campaign    = Campaign::GetCampaign();
		update_time = campaign->GetUpdateTime();

		lst_news->ClearItems();
		txt_news->SetText("");

		if (img_news)
		img_news->SetPicture(bmp_default);
	}

	if (campaign) {
		List<CombatEvent>& events      = campaign->GetEvents();
		bool               auto_scroll = false;

		if (events.size() > lst_news->NumItems()) {
			while (events.size() > lst_news->NumItems()) {
				CombatEvent* info = events[lst_news->NumItems()];

				const char* unread = info->Visited() ? " " : "*";
				int i = lst_news->AddItemWithData(unread, (DWORD) info) - 1;

				char dateline[32];
				FormatDayTime(dateline, info->Time());
				lst_news->SetItemText(i, 1, dateline);
				lst_news->SetItemText(i, 2, info->Title());
				lst_news->SetItemText(i, 3, info->Region());
				lst_news->SetItemText(i, 4, Game::GetText(info->SourceName()));

				if (!info->Visited())
				auto_scroll = true;
			}

			if (lst_news->GetSortColumn() > 0)
			lst_news->SortItems();
		}

		else if (events.size() < lst_news->NumItems()) {
			lst_news->ClearItems();

			for (int i = 0; i < events.size(); i++) {
				CombatEvent* info = events[i];

				const char* unread = info->Visited() ? " " : "*";
				int j = lst_news->AddItemWithData(unread, (DWORD) info) - 1;

				char dateline[32];
				FormatDayTime(dateline, info->Time());
				lst_news->SetItemText(j, 1, dateline);
				lst_news->SetItemText(j, 2, info->Title());
				lst_news->SetItemText(j, 3, info->Region());
				lst_news->SetItemText(j, 4, Game::GetText(info->SourceName()));

				if (!info->Visited())
				auto_scroll = true;
			}

			if (lst_news->GetSortColumn() > 0)
			lst_news->SortItems();

			txt_news->SetText("");

			if (img_news)
			img_news->SetPicture(bmp_default);
		}

		if (auto_scroll) {
			int first_unread = -1;

			for (int i = 0; i < lst_news->NumItems(); i++) {
				if (lst_news->GetItemText(i, 0) == "*") {
					first_unread = i;
					break;
				}
			}

			if (first_unread >= 0)
			lst_news->ScrollTo(first_unread);
		}
	}

	Starshatter* stars = Starshatter::GetInstance();

	if (start_scene > 0) {
		ShowMovie();

		start_scene--;

		if (start_scene == 0) {
			if (stars && campaign) {
				stars->ExecCutscene(event_scene, campaign->Path());

				if (stars->InCutscene()) {
					Sim* sim = Sim::GetSim();

					if (sim) {
						cam_view->UseCamera(CameraDirector::GetInstance()->GetCamera());
						cam_view->UseScene(sim->GetScene());
					}
				}
			}

			event_scene = "";
		}
	}
	else {
		if (dsp_view)
		dsp_view->ExecFrame();

		if (stars->InCutscene())
		ShowMovie();
		else
		HideMovie();
	}
}