-fixed codedump when scrolling through settings with up/down on

dpad
-fixed a bug when pointer gets on screen and some option is selected
via dpad and pointer gets off screen again that the dpad setting was
completely fucked up
-only enable scrolling through settings with dpad if no pointer is
on the screen (to not confuse wiiflow)
-alternative way of booting game with pressing A and pointer not
on screen (for some people the current way didnt work properly)
This commit is contained in:
fix94.1 2012-09-15 19:14:08 +00:00
parent a161a9f308
commit 7ea08544d3
5 changed files with 64 additions and 42 deletions

View File

@ -23,6 +23,7 @@ bool CButtonsMgr::init(CVideo &vid)
m_soundVolume = 0xFF;
m_noclick = false;
m_nohover = false;
m_mouse = false;
m_vid = vid;
soundInit();
@ -211,13 +212,12 @@ void CButtonsMgr::mouse(int chan, int x, int y)
if (m_elts.empty()) return;
float w, h;
u16 s = 0;
if(m_selected[chan] > -1 && m_selected[chan] < (s32)m_elts.size())
u16 start = 0;
if(m_selected[chan] != -1 && m_selected[chan] < (s32)m_elts.size())
{
m_elts[m_selected[chan]]->targetScaleX = 1.f;
m_elts[m_selected[chan]]->targetScaleY = 1.f;
s = (u16)m_selected[chan];
start = (u16)m_selected[chan];
}
m_selected[chan] = -1;
for(int i = (int)m_elts.size() - 1; i >= 0; --i)
@ -234,7 +234,7 @@ void CButtonsMgr::mouse(int chan, int x, int y)
but.targetScaleX = 1.05f;
but.targetScaleY = 1.05f;
//
if (s != m_selected[chan])
if(start != m_selected[chan])
{
if(m_soundVolume > 0 && !!but.hoverSound)
if(!m_nohover)
@ -252,14 +252,18 @@ void CButtonsMgr::mouse(int chan, int x, int y)
}
}
void CButtonsMgr::setMouse(bool enable)
{
m_mouse = enable;
}
bool CButtonsMgr::selected(s16 button)
{
for(int chan = WPAD_MAX_WIIMOTES - 1; chan >= 0; chan--)
{
if(m_selected[chan] == button)
{
if(m_selected[chan] != -1)
if(!m_noclick)
if(m_selected[chan] != -1 && !m_noclick)
click(m_selected[chan]);
return true;
}
@ -269,57 +273,61 @@ bool CButtonsMgr::selected(s16 button)
void CButtonsMgr::up(void)
{
if (m_elts.empty()) return;
if(m_elts.empty() || m_mouse)
return;
u32 start = 0;
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if (m_selected[chan] < (s32)m_elts.size())
if(m_selected[chan] != -1 && m_selected[chan] < (s32)m_elts.size())
{
m_elts[m_selected[chan]]->targetScaleX = 1.f;
m_elts[m_selected[chan]]->targetScaleY = 1.f;
start = m_selected[chan];
}
u32 start = m_selected[chan];
m_selected[chan] = -1;
}
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum(start - i, m_elts.size());
CButtonsMgr::SElement &b = *m_elts[j];
if (b.t == CButtonsMgr::GUIELT_BUTTON && b.visible)
{
m_selected[chan] = j;
m_selected[0] = j;
b.targetScaleX = 1.1f;
b.targetScaleY = 1.1f;
break;
}
}
}
}
void CButtonsMgr::down(void)
{
if (m_elts.empty()) return;
if(m_elts.empty() || m_mouse)
return;
u32 start = 0;
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if (m_selected[chan] < (s32)m_elts.size())
if(m_selected[chan] != -1 && m_selected[chan] < (s32)m_elts.size())
{
m_elts[m_selected[chan]]->targetScaleX = 1.f;
m_elts[m_selected[chan]]->targetScaleY = 1.f;
start = m_selected[chan];
}
u32 start = m_selected[chan];
m_selected[chan] = -1;
}
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum(start + i, m_elts.size());
CButtonsMgr::SElement &b = *m_elts[j];
if (b.t == CButtonsMgr::GUIELT_BUTTON && b.visible)
{
m_selected[chan] = j;
m_selected[0] = j;
b.targetScaleX = 1.1f;
b.targetScaleY = 1.1f;
break;
}
}
}
}
void CButtonsMgr::noHover(bool nohover)
{

View File

@ -51,6 +51,7 @@ public:
void hide(s16 id, bool instant = false);
void show(s16 id, bool instant = false);
void mouse(int chan, int x, int y);
void setMouse(bool enable);
void up(void);
void down(void);
void draw(void);
@ -148,6 +149,7 @@ private:
u8 m_soundVolume;
bool m_noclick;
bool m_nohover;
bool m_mouse;
CVideo m_vid;
private:
void _drawBtn(const SButton &b, bool selected, bool click);

View File

@ -638,6 +638,7 @@ private:
void ShowPrevZone(void);
void ShowNextZone(void);
void ShowGameZone(void);
bool ShowPointer(void);
bool m_show_zone_main;
bool m_show_zone_main2;
bool m_show_zone_main3;

View File

@ -541,7 +541,7 @@ void CMenu::_game(bool launch)
if(!m_gameSound.IsPlaying())
startGameSound = -6;
}
else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || !m_show_zone_game)
else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || !ShowPointer())
{
_hideGame();
m_gameSound.FreeMemory();

View File

@ -103,6 +103,7 @@ void CMenu::ScanInput()
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
m_btnMgr.setRumble(chan, WPadIR_Valid(chan), PAD_StickX(chan) < -20 || PAD_StickX(chan) > 20 || PAD_StickY(chan) < -20 || PAD_StickY(chan) > 20);
m_btnMgr.setMouse(WPadIR_Valid(chan) || m_show_pointer[chan]);
if(WPadIR_Valid(chan))
{
m_cursor[chan].draw(wd[chan]->ir.x, wd[chan]->ir.y, wd[chan]->ir.angle);
@ -205,6 +206,16 @@ bool CMenu::WPadIR_Valid(int chan)
return false;
}
bool CMenu::ShowPointer(void)
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if(WPadIR_Valid(chan) || m_show_pointer[chan])
return true;
}
return false;
}
bool CMenu::WPadIR_ANY(void)
{
return (wd[0]->ir.valid || wd[1]->ir.valid || wd[2]->ir.valid || wd[3]->ir.valid);