예제 #1
0
BannerWindow::BannerWindow(GameBrowseMenu *m, struct discHdr *header)
	: GuiWindow(screenwidth, screenheight)
	, browserMenu(m)
	, MaxAnimSteps(Settings.BannerZoomDuration)
{
	ScreenProps.x = screenwidth;
	ScreenProps.y = screenheight;

	f32 xOffset = Settings.BannerProjectionOffsetX;
	f32 yOffset = Settings.BannerProjectionOffsetY;

	guMtxIdentity(modelview);
	guMtxTransApply (modelview, modelview, xOffset, yOffset, 0.0F);

	memcpy(&originalProjection, &FSProjection2D, sizeof(Mtx44));

	returnVal = -1;
	gameSelected = 0;
	gameSound = NULL;
	dvdheader = NULL;
	reducedVol = false;

	if(!bannerFrame.IsLoaded())
		bannerFrame.Load(U8Archive(SystemMenuResources::Instance()->GetChanTtlAsh(),
								   SystemMenuResources::Instance()->GetChanTtlAshSize()));

	AnimStep = 0;
	AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
	AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
	AnimZoomIn = true;
	AnimationRunning = false;

	int gameIdx;

	//! get the game index to this header
	for(gameIdx = 0; gameIdx < gameList.size(); ++gameIdx)
	{
		if(gameList[gameIdx] == header)
		{
			gameSelected = gameIdx;
			break;
		}
	}

	//! Set dvd header if the header does not match any of the list games
	if(gameIdx == gameList.size())
		dvdheader = header;

	GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
	if(bannerBrowser)
		bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);

	gameBanner = new Banner;

	imgLeft = Resources::GetImageData("startgame_arrow_left.png");
	imgRight = Resources::GetImageData("startgame_arrow_right.png");

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
	trigL = new GuiTrigger;
	trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
	trigR = new GuiTrigger;
	trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
	trigPlus = new GuiTrigger;
	trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_R);
	trigMinus = new GuiTrigger;
	trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, PAD_TRIGGER_L);

	playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - banner window playcount text color"));
	playcntTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	playcntTxt->SetPosition(thInt("0 - banner window play count pos x"),
							thInt("215 - banner window play count pos y") - Settings.AdjustOverscanY / 2);

	settingsBtn = new GuiButton(215, 75);
	settingsBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	settingsBtn->SetSoundOver(btnSoundOver);
	settingsBtn->SetSoundClick(btnSoundAccept);
	settingsBtn->SetPosition(-120, 175);
	settingsBtn->SetTrigger(trigA);

	startBtn = new GuiButton(215, 75);
	startBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	startBtn->SetSoundOver(btnSoundOver);
	startBtn->SetSoundClick(btnSoundClick3);
	startBtn->SetPosition(110, 175);
	startBtn->SetTrigger(trigA);

	backBtn = new GuiButton(215, 75);
	backBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	backBtn->SetSoundOver(btnSoundOver);
	backBtn->SetSoundClick(btnSoundBack);
	backBtn->SetPosition(-screenwidth, -screenheight); // set out of screen
	backBtn->SetTrigger(0, trigA);
	backBtn->SetTrigger(1, trigB);

	btnLeftImg = new GuiImage(imgLeft);
	if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
	btnLeft = new GuiButton(btnLeftImg, btnLeftImg, ALIGN_LEFT, ALIGN_MIDDLE, 20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnLeft->SetTrigger(trigL);
	btnLeft->SetTrigger(trigMinus);

	btnRightImg = new GuiImage(imgRight);
	if (Settings.wsprompt) btnRightImg->SetWidescreen(Settings.widescreen);
	btnRight = new GuiButton(btnRightImg, btnRightImg, ALIGN_RIGHT, ALIGN_MIDDLE, -20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnRight->SetTrigger(trigR);
	btnRight->SetTrigger(trigPlus);

	if (Settings.ShowPlayCount)
		Append(playcntTxt);
	Append(backBtn);

	if (!dvdheader) //stuff we don't show if it is a DVD mounted
	{
		Append(btnLeft);
		Append(btnRight);
	}

	bannerFrame.SetButtonBText(tr("Start"));

	//check if unlocked
	if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
	{
		bannerFrame.SetButtonAText(tr("Settings"));
		Append(settingsBtn);
	}
	else
	{
		bannerFrame.SetButtonAText(tr("Back"));
		backBtn->SetPosition(-120, 175);
	}

	Append(startBtn); //! Appending the disc on top of all

	ChangeGame(false);
}
예제 #2
0
BannerWindow::BannerWindow(GameBrowseMenu *m, struct discHdr *header)
	: GuiWindow(screenwidth, screenheight)
	, browserMenu(m)
	, MaxAnimSteps(Settings.BannerZoomDuration)
{
	ScreenProps.x = screenwidth;
	ScreenProps.y = screenheight;

	f32 xOffset = Settings.BannerProjectionOffsetX;
	f32 yOffset = Settings.BannerProjectionOffsetY;

	guMtxIdentity(modelview);
	guMtxTransApply (modelview, modelview, xOffset, yOffset, 0.0F);

	memcpy(&originalProjection, &FSProjection2D, sizeof(Mtx44));

	returnVal = -1;
	gameSelected = 0;
	gameSound = NULL;
	dvdheader = NULL;
	reducedVol = false;

	if(!bannerFrame.IsLoaded())
		bannerFrame.Load(U8Archive(SystemMenuResources::Instance()->GetChanTtlAsh(),
								   SystemMenuResources::Instance()->GetChanTtlAshSize()));

	AnimStep = 0;
	AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
	AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
	AnimZoomIn = true;
	AnimationRunning = false;

	int gameIdx;

	//! get the game index to this header
	for(gameIdx = 0; gameIdx < gameList.size(); ++gameIdx)
	{
		if(gameList[gameIdx] == header)
		{
			gameSelected = gameIdx;
			break;
		}
	}

	//! Set dvd header if the header does not match any of the list games
	if(gameIdx == gameList.size())
		dvdheader = header;

	GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
	if(bannerBrowser)
		bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);

	gameBanner = new Banner;

	imgFavorite = Resources::GetImageData("favorite.png");
	imgNotFavorite = Resources::GetImageData("not_favorite.png");
	imgLeft = Resources::GetImageData("startgame_arrow_left.png");
	imgRight = Resources::GetImageData("startgame_arrow_right.png");

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
	trigL = new GuiTrigger;
	trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
	trigR = new GuiTrigger;
	trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
	trigPlus = new GuiTrigger;
	trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_R);
	trigMinus = new GuiTrigger;
	trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, PAD_TRIGGER_L);

	playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - banner window playcount text color"));
	playcntTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	playcntTxt->SetPosition(thInt("0 - banner window play count pos x"),
							thInt("215 - banner window play count pos y") - Settings.AdjustOverscanY / 2);

	settingsBtn = new GuiButton(215, 75);
	settingsBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	settingsBtn->SetSoundOver(btnSoundOver);
	settingsBtn->SetSoundClick(btnSoundClick2);
	settingsBtn->SetPosition(-120, 175);
	settingsBtn->SetTrigger(trigA);

	startBtn = new GuiButton(215, 75);
	startBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	startBtn->SetSoundOver(btnSoundOver);
	startBtn->SetSoundClick(btnSoundClick2);
	startBtn->SetPosition(110, 175);
	startBtn->SetTrigger(trigA);

	backBtn = new GuiButton(215, 75);
	backBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	backBtn->SetSoundOver(btnSoundOver);
	backBtn->SetSoundClick(btnSoundClick2);
	backBtn->SetPosition(-screenwidth, -screenheight); // set out of screen
	backBtn->SetTrigger(0, trigA);
	backBtn->SetTrigger(1, trigB);

	// Set favorite button position
	int xPos = -198-(3*27)-14;
	if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEA) // push more to the screen border
		xPos += -14;
	int yPos = 175-27;
	float angle = 3*M_PI/2;	
	for(int i = 0; i < FAVORITE_STARS; ++i)
	{
		
		if(Settings.bannerFavIcon == BANNER_FAVICON_CIRC)
		{
			/*
			Arrangement:
			   0
			  1
			 2
			  3
			   4
			*/
			
			if (i==0 || i == 4){
				xPos = (-180-70 - 40*cos(angle)); //litte adjustment, image looks too far
			}
			else{
				xPos = (-180-65 - 40*cos(angle));
			}
			yPos = (169 + 40*sin(angle));
			angle += M_PI/4;
			
			/*
			if (i == 0){
				xPos += 27+14;
			}else if (i < 3){
				xPos += -14;
				yPos += 27;
			} else if (i >= 3){
				xPos += 14;
				yPos += 27;
			}
			*/
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SIN)
		{
			/*
			Arrangement:
			0 2 4
			 1 3
			*/
			
			xPos += 27;
			xPos += -14;
			if ((i&1)==0)
			{
				yPos += 27;
			}
			else
			{
				yPos -= 27;
			}
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_MULTI_LINE)
		{
			/*
			Sequential arrangement, 3 on top, 2 at bottom:
			1 2 3
			 4 5
			*/
			
			xPos += 27;
			if (i==2){
				xPos += -27-27-14;
				yPos += 27;
			}
		
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEA)
		{
			/* Arrangement : inline above the settings */
			xPos += 27;
			yPos = 95;
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEB)
		{
			/* Arrangement : inline below the settings */
			xPos += 27;
			yPos = 210;
		}
		
		FavoriteBtnImg[i] = new GuiImage;
		FavoriteBtnImg[i]->SetWidescreen(Settings.widescreen);
		FavoriteBtn[i] = new GuiButton(imgFavorite->GetWidth(), imgFavorite->GetHeight());
		FavoriteBtn[i]->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
		FavoriteBtn[i]->SetPosition(xPos, yPos);
		FavoriteBtn[i]->SetImage(FavoriteBtnImg[i]);
		FavoriteBtn[i]->SetSoundOver(btnSoundOver);
		FavoriteBtn[i]->SetSoundClick(btnSoundClick2);
		FavoriteBtn[i]->SetTrigger(trigA);
		FavoriteBtn[i]->SetEffectGrow();
	}

	btnLeftImg = new GuiImage(imgLeft);
	if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
	btnLeft = new GuiButton(btnLeftImg, btnLeftImg, ALIGN_LEFT, ALIGN_MIDDLE, 20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnLeft->SetTrigger(trigL);
	btnLeft->SetTrigger(trigMinus);

	btnRightImg = new GuiImage(imgRight);
	if (Settings.wsprompt) btnRightImg->SetWidescreen(Settings.widescreen);
	btnRight = new GuiButton(btnRightImg, btnRightImg, ALIGN_RIGHT, ALIGN_MIDDLE, -20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnRight->SetTrigger(trigR);
	btnRight->SetTrigger(trigPlus);

	if (Settings.ShowPlayCount)
		Append(playcntTxt);
	Append(backBtn);

	if (!dvdheader) //stuff we don't show if it is a DVD mounted
	{
		Append(btnLeft);
		Append(btnRight);
	}

	bannerFrame.SetButtonBText(tr("Start"));

	//check if unlocked
	if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
	{
		bannerFrame.SetButtonAText(tr("Settings"));
		Append(settingsBtn);
		if(Settings.bannerFavIcon != BANNER_FAVICON_OFF)
			for(int i = 0; i < FAVORITE_STARS; ++i)
				Append(FavoriteBtn[i]);
	}
	else
	{
		bannerFrame.SetButtonAText(tr("Back"));
		backBtn->SetPosition(-120, 175);
	}

	Append(startBtn); //! Appending the disc on top of all

	ChangeGame(false);
}