CTranscendenceWnd::CTranscendenceWnd (HWND hWnd, CTranscendenceController *pTC) : m_hWnd(hWnd),
		m_pTC(pTC),
		m_State(gsNone),
		m_pLargeHUD(NULL),
		m_pCurrentScreen(NULL),
		m_bShowingMap(false),
		m_bDebugConsole(false),
		m_bAutopilot(false),
		m_iDamageFlash(0),
		m_dwIntroShipClass(0),
		m_CurrentMenu(menuNone),
		m_CurrentPicker(pickNone),
		m_pIntroSystem(NULL),
		m_pMenuObj(NULL),
		m_bRedirectDisplayMessage(false),
		m_pCrawlImage(NULL),
		m_chKeyDown('\0'),
		m_bDockKeyDown(false),
		m_bNextWeaponKey(false),
		m_bNextMissileKey(false),
		m_bPrevWeaponKey(false),
		m_bPrevMissileKey(false)

//	CTranscendence constructor

	{
	ClearDebugLines();
	}
示例#2
0
ALERROR CTranscendenceWnd::StartIntro (void)

//	StartIntro
//
//	Start introduction

	{
	ALERROR error;
	int i;

	ClearDebugLines();

	//	Use widescreen topology

	int cyBarHeight = (g_cyScreen - INTRO_DISPLAY_HEIGHT) / 2;
	m_rcIntroTop.top = 0;
	m_rcIntroTop.left = 0;
	m_rcIntroTop.bottom = cyBarHeight;
	m_rcIntroTop.right = g_cxScreen;

	m_rcIntroMain.top = cyBarHeight;
	m_rcIntroMain.left = 0;
	m_rcIntroMain.bottom = g_cyScreen - cyBarHeight;
	m_rcIntroMain.right = g_cxScreen;

	m_rcIntroBottom.top = g_cyScreen - cyBarHeight;
	m_rcIntroBottom.left = 0;
	m_rcIntroBottom.bottom = g_cyScreen;
	m_rcIntroBottom.right = g_cxScreen;

	m_Screen.DrawRectFilled(m_rcIntroTop.left, m_rcIntroTop.top,m_rcIntroTop.right, m_rcIntroTop.bottom, CGImage::RGBColor(0, 0, 0));
	m_Screen.DrawRectFilled(m_rcIntroBottom.left, m_rcIntroBottom.top,m_rcIntroBottom.right, m_rcIntroBottom.bottom, CGImage::RGBColor(0, 0, 0));
	//	Create the High-Score display

	RECT rcRect;
	rcRect.left = m_rcMainScreen.left + HIGHSCORE_DISPLAY_X;
	rcRect.top = m_rcMainScreen.top + HIGHSCORE_DISPLAY_Y;
	rcRect.right = rcRect.left + HIGHSCORE_DISPLAY_WIDTH;
	rcRect.bottom = rcRect.top + HIGHSCORE_DISPLAY_HEIGHT;
	m_HighScoreDisplay.Init(rcRect, m_pHighScoreList, m_iLastHighScore);
	m_HighScoreDisplay.SetFontTable(&m_Fonts);
	m_HighScoreDisplay.Update();

	//	Create the player display

	m_PlayerDisplay.Init(this, m_rcIntroTop, m_Options.bDebugMode);

	//	Create the buttons

	m_ButtonBar.Init();

	CString sContinueLabel = ComputeLoadGameLabel(&m_bSavedGame);
	m_ButtonBar.AddButton(CMD_CONTINUE_OLD_GAME,
			CONSTLIT("Continue Game"),
			sContinueLabel,
			CONSTLIT("C"),
			0,
			CButtonBarData::alignLeft);
	if (sContinueLabel.IsBlank())
		m_ButtonBar.SetVisible(0, false);

	m_ButtonBar.AddButton(CMD_START_NEW_GAME,
			CONSTLIT("New Game"),
			CONSTLIT("Begin a New Game"),
			CONSTLIT("N"),
			1,
			CButtonBarData::alignCenter);

	m_ButtonBar.AddButton(CMD_QUIT_GAME,
			CONSTLIT("Quit"),
			CONSTLIT("Exit Transcendence"),
			CONSTLIT("Q"),
			2,
			CButtonBarData::alignRight);

	m_ButtonBarDisplay.SetFontTable(&m_Fonts);
	m_ButtonBarDisplay.Init(this, &m_ButtonBar, m_rcIntroBottom);

	//	Create an empty system

	if (error = m_Universe.CreateEmptyStarSystem(&m_pIntroSystem))
		{
		ASSERT(false);
		return error;
		}

	m_Universe.SetCurrentSystem(m_pIntroSystem);

	CSovereign *pSovereign1 = m_Universe.FindSovereign(g_PlayerSovereignUNID);
	CSovereign *pSovereign2 = m_Universe.FindSovereign(g_PirateSovereignUNID);

	//	Create a couple of random enemy ships

	CShip *pShip1;
	CShip *pShip2;
	if ((error = CreateRandomShip(m_pIntroSystem, pSovereign1, &pShip1)))
		{
		ASSERT(false);
		return error;
		}

	if ((error = CreateRandomShip(m_pIntroSystem, pSovereign2, &pShip2)))
		{
		ASSERT(false);
		return error;
		}

	//	Make the ships attack each other

	for (i = 0; i < m_pIntroSystem->GetObjectCount(); i++)
		{
		CSpaceObject *pObj = m_pIntroSystem->GetObject(i);

		if (pObj
				&& pObj->GetCategory() == CSpaceObject::catShip
				&& !pObj->GetData(CONSTLIT("IntroController")).IsBlank())
			{
			CShip *pShip = pObj->AsShip();
			if (pShip)
				{
				IShipController *pController = pShip->GetController();
				if (pShip->GetSovereign() == pSovereign1)
					pController->AddOrder(IShipController::orderDestroyTarget, pShip2, 0);
				else
					pController->AddOrder(IShipController::orderDestroyTarget, pShip1, 0);
				}
			}
		}

	//	Other initialization

	m_bOverwriteGameDlg = false;
	m_rcOverwriteGameDlg.left = m_rcIntroMain.left + (RectWidth(m_rcIntroMain) - DIALOG_WIDTH) / 2;
	m_rcOverwriteGameDlg.top = m_rcIntroMain.top + (RectHeight(m_rcIntroMain) - DIALOG_HEIGHT) / 2;
	m_rcOverwriteGameDlg.right = m_rcOverwriteGameDlg.left + DIALOG_WIDTH;
	m_rcOverwriteGameDlg.bottom = m_rcOverwriteGameDlg.top + DIALOG_HEIGHT;

	int cxMid = m_rcOverwriteGameDlg.left + (DIALOG_WIDTH / 2);
	m_rcOverwriteGameOK.left = cxMid - DIALOG_SPACING_X - DIALOG_BUTTON_WIDTH;
	m_rcOverwriteGameOK.top = m_rcOverwriteGameDlg.bottom - DIALOG_SPACING_Y - DIALOG_BUTTON_HEIGHT;
	m_rcOverwriteGameOK.right = m_rcOverwriteGameOK.left + DIALOG_BUTTON_WIDTH;
	m_rcOverwriteGameOK.bottom = m_rcOverwriteGameOK.top + DIALOG_BUTTON_HEIGHT;

	m_rcOverwriteGameCancel = m_rcOverwriteGameOK;
	m_rcOverwriteGameCancel.left = cxMid + DIALOG_SPACING_X;
	m_rcOverwriteGameCancel.right = m_rcOverwriteGameCancel.left + DIALOG_BUTTON_WIDTH;

	//	No sound

	m_Universe.SetSound(false);

	//	Set the POV to one of them

	m_Universe.SetPOV(pShip1);
	m_iTick = 0;
	m_iLastShipCreated = m_iTick;

	m_State = gsIntro;

	//	Show the cursor

	SDL_ShowCursor(true);

	return NOERROR;
	}
示例#3
0
ALERROR CTranscendenceWnd::StartIntro (CIntroSession *pThis)

//	StartIntro
//
//	Start introduction

	{
	//	Temporarily set this member variable because some of our functions are
	//	implemented in CTranscendenceWnd. Over time, all those functions should
	//	be moved to CIntroSession.

	m_pIntroSession = pThis;

	//	Init

	ClearDebugLines();

	//	Use widescreen topology

	int cyBarHeight = Max(128, (g_cyScreen - INTRO_DISPLAY_HEIGHT) / 2);
	m_rcIntroTop.top = 0;
	m_rcIntroTop.left = 0;
	m_rcIntroTop.bottom = cyBarHeight;
	m_rcIntroTop.right = g_cxScreen;

	m_rcIntroMain.top = cyBarHeight;
	m_rcIntroMain.left = 0;
	m_rcIntroMain.bottom = g_cyScreen - cyBarHeight;
	m_rcIntroMain.right = g_cxScreen;

	m_rcIntroBottom.top = g_cyScreen - cyBarHeight;
	m_rcIntroBottom.left = 0;
	m_rcIntroBottom.bottom = g_cyScreen;
	m_rcIntroBottom.right = g_cxScreen;

	//	Create the buttons

	m_ButtonBar.Init();

	m_bSavedGame = false;
	m_ButtonBar.AddButton(CMD_CONTINUE_OLD_GAME,
			CONSTLIT("Load Game"),
			CONSTLIT("Continue a Previous Game"),
			CONSTLIT("C"),
			0,
			CButtonBarData::alignLeft);

	m_ButtonBar.AddButton(CMD_START_NEW_GAME,
			CONSTLIT("New Game"),
			CONSTLIT("Begin a New Game"),
			CONSTLIT("N"),
			1,
			CButtonBarData::alignCenter);

	m_ButtonBar.AddButton(CMD_QUIT_GAME,
			CONSTLIT("Quit"),
			CONSTLIT("Exit Transcendence"),
			CONSTLIT("Q"),
			2,
			CButtonBarData::alignRight);

	m_ButtonBarDisplay.SetFontTable(&m_Fonts);
	m_ButtonBarDisplay.Init(this, &m_ButtonBar, m_rcIntroBottom);

	//	Create the credits performance

	IAnimatron *pAnimation;
	CreateCreditsAnimation(&pAnimation);
	m_dwCreditsPerformance = m_Reanimator.AddPerformance(pAnimation, ID_CREDITS_PERFORMANCE);

	//	Create the titles performance

	CreateTitleAnimation(&pAnimation);
	m_dwTitlesPerformance = m_Reanimator.AddPerformance(pAnimation, ID_TITLES_PERFORMANCE);

	//	Create the top bar

	CreatePlayerBarAnimation(&pAnimation);
	m_dwPlayerBarPerformance = m_Reanimator.AddPerformance(pAnimation, ID_PLAYER_BAR_PERFORMANCE);
	m_Reanimator.StartPerformance(m_dwPlayerBarPerformance);

	SetMusicOption();
	SetDebugOption();
	SetAccountControls(m_pTC->GetMultiverse());

	//	Start

	m_State = gsIntro;

	return NOERROR;
	}