From ab2bd752f008a5434f0b4a398061c375e022a7a9 Mon Sep 17 00:00:00 2001 From: dborth Date: Sat, 13 Jun 2009 01:38:21 +0000 Subject: [PATCH] fix savebrowser bugs --- source/ngc/gui/gui.h | 1 + source/ngc/gui/gui_savebrowser.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/ngc/gui/gui.h b/source/ngc/gui/gui.h index 2e92676..9e029db 100644 --- a/source/ngc/gui/gui.h +++ b/source/ngc/gui/gui.h @@ -843,6 +843,7 @@ class GuiSaveBrowser : public GuiElement int selectedItem; int listOffset; int action; + bool saveBtnLastOver[SAVELISTSIZE]; SaveList * saves; GuiButton * saveBtn[SAVELISTSIZE]; diff --git a/source/ngc/gui/gui_savebrowser.cpp b/source/ngc/gui/gui_savebrowser.cpp index 586c961..e78cd37 100644 --- a/source/ngc/gui/gui_savebrowser.cpp +++ b/source/ngc/gui/gui_savebrowser.cpp @@ -114,7 +114,10 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a) saveBtn[i]->SetVisible(false); saveBtn[i]->SetSoundOver(btnSoundOver); saveBtn[i]->SetSoundClick(btnSoundClick); + saveBtnLastOver[i] = false; } + saveBtn[0]->SetState(STATE_SELECTED, -1); + saveBtn[0]->SetVisible(true); } /** @@ -229,6 +232,8 @@ void GuiSaveBrowser::Update(GuiTrigger * t) if(!focus) goto endNavigation; // skip navigation + if(selectedItem < 0) selectedItem = 0; + if(t->Right()) { if(selectedItem == SAVELISTSIZE-1) @@ -384,12 +389,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t) else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT) saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); - if(t->wpad.ir.valid && !saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y) - && saveBtn[i]->GetState() == STATE_SELECTED) + if(t->wpad.ir.valid) { - saveBtn[i]->ResetState(); - if(selectedItem == i) - selectedItem = -1; + if(!saveBtnLastOver[i] && saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + saveBtn[i]->ResetState(); + saveBtnLastOver[i] = saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y); } saveBtn[i]->Update(t);