mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-removed a few things from banner code which we dont use
-added setting to wiiflow.ini to toogle banner view per coverflow view -moved icons down a bit in game view
This commit is contained in:
parent
8fec6f98ce
commit
365884d556
@ -21,6 +21,8 @@
|
||||
#include "gx_addons.h"
|
||||
#include "gecko.h"
|
||||
|
||||
BannerWindow *m_banner;
|
||||
|
||||
void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
|
||||
{
|
||||
changing = true;
|
||||
@ -38,11 +40,7 @@ void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
|
||||
|
||||
AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
|
||||
AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
|
||||
AnimZoomIn = false;
|
||||
AnimZoomOut = false;
|
||||
AnimationRunning = false;
|
||||
BannerAlpha = 255.f;
|
||||
BGAlpha = 255.f;
|
||||
|
||||
ChangeGame(banner);
|
||||
gameSelected = 1;
|
||||
@ -57,7 +55,9 @@ void BannerWindow::DeleteBanner()
|
||||
|
||||
BannerWindow::BannerWindow()
|
||||
{
|
||||
FontLoaded = false;
|
||||
changing = false;
|
||||
AnimZoom = false;
|
||||
AnimStep = 20;
|
||||
gameSelected = 0;
|
||||
gameBanner = new AnimatedBanner;
|
||||
@ -66,62 +66,39 @@ BannerWindow::BannerWindow()
|
||||
void BannerWindow::ChangeGame(Banner *banner)
|
||||
{
|
||||
gameBanner->Clear();
|
||||
gameBanner->LoadFont(sysFont1, sysFont2);
|
||||
if(!FontLoaded)
|
||||
{
|
||||
gameBanner->LoadFont(sysFont1, sysFont2);
|
||||
FontLoaded = true;
|
||||
}
|
||||
gameBanner->LoadBanner(banner);
|
||||
}
|
||||
|
||||
void BannerWindow::ZoomIn(void)
|
||||
bool BannerWindow::ToogleZoom(void)
|
||||
{
|
||||
AnimZoomIn = true;
|
||||
AnimZoomOut = false;
|
||||
if(AnimStep <= 20)
|
||||
AnimStep++;
|
||||
}
|
||||
|
||||
void BannerWindow::PauseZoom(void)
|
||||
{
|
||||
AnimZoomIn = false;
|
||||
AnimZoomOut = false;
|
||||
}
|
||||
|
||||
void BannerWindow::ZoomOut(void)
|
||||
{
|
||||
AnimZoomIn = false;
|
||||
AnimZoomOut = true;
|
||||
if(AnimStep >= MaxAnimSteps)
|
||||
AnimStep--;
|
||||
if(AnimZoom)
|
||||
{
|
||||
AnimStep = 30;
|
||||
AnimZoom = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AnimStep = 20;
|
||||
AnimZoom = true;
|
||||
}
|
||||
return AnimZoom;
|
||||
}
|
||||
|
||||
void BannerWindow::Animate(void)
|
||||
{
|
||||
// animation is on going
|
||||
if(AnimStep < MaxAnimSteps)
|
||||
if(AnimStep <= MaxAnimSteps)
|
||||
{
|
||||
AnimationRunning = true;
|
||||
if(AnimZoomIn && AnimStep < MaxAnimSteps)
|
||||
if(AnimZoom && AnimStep < MaxAnimSteps)
|
||||
AnimStep++;
|
||||
else if(AnimZoomOut && AnimStep > 20)
|
||||
else if(!AnimZoom && AnimStep > 20)
|
||||
AnimStep--;
|
||||
|
||||
/*
|
||||
// zoom in animation
|
||||
if(AnimZoomIn) {
|
||||
BGAlpha = std::min(255.f * AnimStep * 2.f / MaxAnimSteps, 255.f);
|
||||
//if(AnimStep < 0.4f * MaxAnimSteps)
|
||||
//BannerAlpha = 0;
|
||||
//else
|
||||
//BannerAlpha = std::min(255.f * (AnimStep - 0.4f * MaxAnimSteps) / (0.6f * MaxAnimSteps), 255.f);
|
||||
}
|
||||
// zoom out animation
|
||||
else {
|
||||
BGAlpha = std::min(255.f * (MaxAnimSteps-AnimStep) * 2.f / MaxAnimSteps, 255.f);
|
||||
//if((MaxAnimSteps - AnimStep) < 0.4f * MaxAnimSteps)
|
||||
//BannerAlpha = 0;
|
||||
//else
|
||||
//BannerAlpha = std::min(255.f * ((MaxAnimSteps - AnimStep) - 0.4f * MaxAnimSteps) / (0.6f * MaxAnimSteps), 255.f);
|
||||
}
|
||||
*/
|
||||
|
||||
float curAnimStep = ((float)(MaxAnimSteps - AnimStep)/(float)MaxAnimSteps);
|
||||
|
||||
float stepx1 = -AnimPosX;
|
||||
@ -134,10 +111,6 @@ void BannerWindow::Animate(void)
|
||||
float left = AnimPosX + stepx1 * curAnimStep;
|
||||
float right = AnimPosX + fIconWidth + stepx2 * curAnimStep;
|
||||
|
||||
// set main projection of all GUI stuff if we are using the banner browser
|
||||
//if(dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser()) != NULL)
|
||||
// guOrtho(FSProjection2D, top, bottom, left, right, 0, 10000);
|
||||
|
||||
float xDiff = 0.5f * (video->wide() ? (video->vid_50hz() ? 616 : 620.0f) : 608.0f);
|
||||
float yDiff = 0.5f * (video->vid_50hz() ? 448.0f : 470.0f);
|
||||
|
||||
@ -163,18 +136,14 @@ void BannerWindow::Animate(void)
|
||||
}
|
||||
// last animation step
|
||||
else if(AnimationRunning)
|
||||
{
|
||||
// set back original projection and stop animation/render of the browser (save some CPU ;P)
|
||||
//memcpy(&video->projMtx, &originalProjection, sizeof(Mtx44));
|
||||
AnimationRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
void BannerWindow::Draw(void)
|
||||
{
|
||||
// draw a black background image first
|
||||
if(AnimStep >= MaxAnimSteps)
|
||||
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, BGAlpha}, true);
|
||||
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, 255.f});
|
||||
|
||||
if(changing)
|
||||
return;
|
||||
@ -182,10 +151,6 @@ void BannerWindow::Draw(void)
|
||||
// Run window animation
|
||||
Animate();
|
||||
|
||||
// no banner alpha means its the start of the animation
|
||||
if(BannerAlpha == 0)
|
||||
return;
|
||||
|
||||
// cut the unneeded crap
|
||||
Mtx mv1, mv2, mv3;
|
||||
guMtxIdentity(mv2);
|
||||
@ -221,14 +186,12 @@ void BannerWindow::Draw(void)
|
||||
|
||||
if(gameBanner->getBanner())
|
||||
{
|
||||
gameBanner->getBanner()->Render(modelview, ScreenProps, video->wide(), BannerAlpha);
|
||||
gameBanner->getBanner()->Render(modelview, ScreenProps, video->wide(), 255.f);
|
||||
gameBanner->getBanner()->AdvanceFrame();
|
||||
}
|
||||
|
||||
// Setup GX
|
||||
ReSetup_GX();
|
||||
|
||||
//if(AnimationRunning)
|
||||
GX_SetScissor(0, 0, video->width(), video->height());
|
||||
|
||||
// Clear and back to previous projection
|
||||
@ -237,7 +200,7 @@ void BannerWindow::Draw(void)
|
||||
GX_InvalidateTexAll();
|
||||
}
|
||||
|
||||
void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled)
|
||||
void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
|
||||
{
|
||||
Mtx modelViewMtx;
|
||||
guMtxIdentity(modelViewMtx);
|
||||
@ -250,26 +213,13 @@ void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor co
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
|
||||
u8 fmt;
|
||||
long n;
|
||||
int i;
|
||||
f32 x2 = x + width;
|
||||
f32 y2 = y + height;
|
||||
guVector v[] = { { x, y, 0.0f }, { x2, y, 0.0f }, { x2, y2, 0.0f }, { x, y2, 0.0f }, { x, y, 0.0f } };
|
||||
|
||||
if (!filled)
|
||||
{
|
||||
fmt = GX_LINESTRIP;
|
||||
n = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = GX_TRIANGLEFAN;
|
||||
n = 4;
|
||||
}
|
||||
|
||||
GX_Begin(fmt, GX_VTXFMT0, n);
|
||||
for (i = 0; i < n; i++)
|
||||
GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
GX_Position3f32(v[i].x, v[i].y, v[i].z);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
@ -34,15 +34,14 @@ class BannerWindow
|
||||
void DeleteBanner();
|
||||
void LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2);
|
||||
int GetSelectedGame() { return gameSelected; }
|
||||
bool GetZoomSetting() { return AnimZoom; }
|
||||
void Draw(void);
|
||||
void ZoomIn(void);
|
||||
void PauseZoom(void);
|
||||
void ZoomOut(void);
|
||||
bool ToogleZoom(void);
|
||||
protected:
|
||||
int MainLoop();
|
||||
void Animate(void);
|
||||
void ChangeGame(Banner *banner);
|
||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);
|
||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
||||
void ReSetup_GX(void);
|
||||
|
||||
static const float fBannerWidth = 608.f;
|
||||
@ -61,23 +60,20 @@ class BannerWindow
|
||||
int AnimStep;
|
||||
float AnimPosX, AnimPosY;
|
||||
float fAnimScale;
|
||||
bool AnimZoomIn;
|
||||
bool AnimZoomOut;
|
||||
bool AnimZoom;
|
||||
bool AnimationRunning;
|
||||
bool oldAnimationRunning;
|
||||
bool changing;
|
||||
|
||||
u8 BGAlpha;
|
||||
u8 BannerAlpha;
|
||||
|
||||
Mtx modelview;
|
||||
Mtx44 projection;
|
||||
Mtx44 originalProjection;
|
||||
Vec2f ScreenProps;
|
||||
|
||||
AnimatedBanner *gameBanner;
|
||||
u8 *sysFont1;
|
||||
u8 *sysFont2;
|
||||
bool FontLoaded;
|
||||
};
|
||||
|
||||
extern BannerWindow *m_banner;
|
||||
|
||||
#endif
|
||||
|
@ -112,7 +112,6 @@ extern const u8 checkboxs_png[];
|
||||
|
||||
SmartBuf m_wbf1_font;
|
||||
SmartBuf m_wbf2_font;
|
||||
BannerWindow m_banner;
|
||||
|
||||
CMenu::CMenu(CVideo &vid) :
|
||||
m_vid(vid)
|
||||
@ -143,6 +142,7 @@ CMenu::CMenu(CVideo &vid) :
|
||||
m_base_font_size = 0;
|
||||
m_current_view = COVERFLOW_USB;
|
||||
m_Emulator_boot = false;
|
||||
m_banner = new BannerWindow;
|
||||
}
|
||||
|
||||
void CMenu::init(void)
|
||||
@ -477,7 +477,7 @@ void CMenu::cleanup(bool ios_reload)
|
||||
m_cf.stopCoverLoader();
|
||||
m_cf.clear();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner.DeleteBanner();
|
||||
m_banner->DeleteBanner();
|
||||
m_plugin.Cleanup();
|
||||
|
||||
_stopSounds();
|
||||
@ -1741,7 +1741,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
|
||||
m_cf.draw();
|
||||
m_vid.setup2DProjection(false, true);
|
||||
m_cf.drawEffect();
|
||||
if(!m_banner.GetSelectedGame())
|
||||
if(!m_banner->GetSelectedGame())
|
||||
m_cf.drawText(adjusting);
|
||||
m_vid.renderAAPass(i);
|
||||
}
|
||||
@ -1759,14 +1759,14 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
|
||||
m_cf.draw();
|
||||
m_vid.setup2DProjection();
|
||||
m_cf.drawEffect();
|
||||
if(!m_banner.GetSelectedGame())
|
||||
if(!m_banner->GetSelectedGame())
|
||||
m_cf.drawText(adjusting);
|
||||
}
|
||||
}
|
||||
|
||||
m_fa.draw();
|
||||
if(m_banner.GetSelectedGame())
|
||||
m_banner.Draw();
|
||||
if(m_banner->GetSelectedGame())
|
||||
m_banner->Draw();
|
||||
|
||||
m_btnMgr.draw();
|
||||
ScanInput();
|
||||
|
@ -376,7 +376,10 @@ void CMenu::_game(bool launch)
|
||||
m_gameSelected = true;
|
||||
}
|
||||
|
||||
extern BannerWindow m_banner;
|
||||
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false);
|
||||
if(m_banner->GetZoomSetting() != m_zoom_banner)
|
||||
m_banner->ToogleZoom();
|
||||
|
||||
string id(m_cf.getId());
|
||||
s8 startGameSound = 1;
|
||||
while(true)
|
||||
@ -411,7 +414,7 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
ClearGameSoundThreadStack();
|
||||
m_banner.DeleteBanner();
|
||||
m_banner->DeleteBanner();
|
||||
break;
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->type == TYPE_WII_GAME || m_cf.getHdr()->type == TYPE_GC_GAME || m_cf.getHdr()->type == TYPE_CHANNEL))
|
||||
@ -489,18 +492,9 @@ void CMenu::_game(bool launch)
|
||||
//m_gameSound.Stop();
|
||||
//CheckGameSoundThread();
|
||||
//break;
|
||||
if(m_zoom_banner)
|
||||
{
|
||||
m_banner.ZoomOut();
|
||||
m_zoom_banner = false;
|
||||
m_show_zone_game = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_banner.ZoomIn();
|
||||
m_zoom_banner = true;
|
||||
m_show_zone_game = false;
|
||||
}
|
||||
m_zoom_banner = m_banner->ToogleZoom();
|
||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||
m_show_zone_game = false;
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameBtnSettings))
|
||||
{
|
||||
@ -1441,12 +1435,12 @@ void CMenu::_initGameMenu(CMenu::SThemeData &theme)
|
||||
|
||||
m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);
|
||||
m_gameBtnBack = _addButton(theme, "GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
|
||||
m_gameBtnFavoriteOn = _addPicButton(theme, "GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 170, 48, 48);
|
||||
m_gameBtnFavoriteOff = _addPicButton(theme, "GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 170, 48, 48);
|
||||
m_gameBtnAdultOn = _addPicButton(theme, "GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 170, 48, 48);
|
||||
m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 170, 48, 48);
|
||||
m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 242, 48, 48);
|
||||
m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 242, 48, 48);
|
||||
m_gameBtnFavoriteOn = _addPicButton(theme, "GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 200, 48, 48);
|
||||
m_gameBtnFavoriteOff = _addPicButton(theme, "GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 200, 48, 48);
|
||||
m_gameBtnAdultOn = _addPicButton(theme, "GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 200, 48, 48);
|
||||
m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48);
|
||||
m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48);
|
||||
m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48);
|
||||
m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 100, 380, 200, 56, theme.btnFontColor);
|
||||
m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 340, 380, 200, 56, theme.btnFontColor);
|
||||
|
||||
@ -1523,10 +1517,9 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
|
||||
extern SmartBuf m_wbf1_font;
|
||||
extern SmartBuf m_wbf2_font;
|
||||
extern BannerWindow m_banner;
|
||||
|
||||
const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize);
|
||||
m_banner.LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get());
|
||||
m_banner->LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get());
|
||||
delete banner;
|
||||
|
||||
if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF'))
|
||||
|
Loading…
Reference in New Issue
Block a user