Skip to content

Commit 539edb8

Browse files
committed
Save Entries Refresh Info
- Unfocus sysmesbox only when completely hidden - Remove redundant MainItems field
1 parent e6e88ac commit 539edb8

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

src/games/chlcc/savemenu.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
6060
// Quick Save Pages initialization
6161

6262
for (int i = 0; i < Pages; i++) {
63-
MainItems = new Widgets::Group(this);
64-
MainItems->WrapFocus = false;
63+
Widgets::Group* mainItems = new Widgets::Group(this);
64+
mainItems->WrapFocus = false;
6565

6666
for (int j = 0; j < EntriesPerPage; j++) {
6767
SaveEntryButton* saveEntryButton =
@@ -70,7 +70,7 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
7070
EntryPositions[j], i, false, LockedSymbolSprite);
7171
saveEntryButton->OnClickHandler = onClick;
7272
saveEntryButton->AddThumbnail(EmptyThumbnailSprite, ThumbnailRelativePos);
73-
MainItems->Add(saveEntryButton);
73+
mainItems->Add(saveEntryButton);
7474
EntryGrid[j] = saveEntryButton;
7575
}
7676

@@ -89,7 +89,7 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
8989
EntryGrid[5]->SetFocus(EntryGrid[4], FDIR_UP);
9090
EntryGrid[5]->SetFocus(EntryGrid[4], FDIR_DOWN);
9191

92-
QuickSavePages.push_back(MainItems);
92+
QuickSavePages.push_back(mainItems);
9393
}
9494
// Maintaining focus across pages
9595
for (auto pageItr = QuickSavePages.begin(); pageItr != QuickSavePages.end();
@@ -120,15 +120,15 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
120120
// Full Save Pages initialization
121121

122122
for (int i = 0; i < Pages; i++) {
123-
MainItems = new Widgets::Group(this);
124-
MainItems->WrapFocus = false;
123+
Widgets::Group* mainItems = new Widgets::Group(this);
124+
mainItems->WrapFocus = false;
125125

126126
for (int j = 0; j < EntriesPerPage; j++) {
127127
SaveEntryButton* saveEntryButton = new SaveEntryButton(
128128
i * EntriesPerPage + j, SaveEntrySprite, EntryHighlightedSprite,
129129
SaveEntrySprite, EntryPositions[j], i, true, LockedSymbolSprite);
130130
saveEntryButton->OnClickHandler = onClick;
131-
MainItems->Add(saveEntryButton);
131+
mainItems->Add(saveEntryButton);
132132
EntryGrid[j] = saveEntryButton;
133133
}
134134

@@ -147,7 +147,7 @@ SaveMenu::SaveMenu() : UI::SaveMenu() {
147147
EntryGrid[5]->SetFocus(EntryGrid[4], FDIR_UP);
148148
EntryGrid[5]->SetFocus(EntryGrid[4], FDIR_DOWN);
149149

150-
FullSavePages.push_back(MainItems);
150+
FullSavePages.push_back(mainItems);
151151
}
152152

153153
// Maintaining focus across pages

src/games/chlcc/sysmesbox.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,27 @@ void SysMesBox::Show() {
115115
void SysMesBox::Hide() {
116116
FadeAnimation.StartOut();
117117
State = Hiding;
118-
if (LastFocusedMenu != 0) {
119-
UI::FocusedMenu = LastFocusedMenu;
120-
LastFocusedMenu->IsFocused = true;
121-
} else {
122-
UI::FocusedMenu = 0;
123-
}
124-
IsFocused = false;
125118
}
126119

127120
void SysMesBox::Update(float dt) {
128121
UpdateInput(dt);
129122

130123
FadeAnimation.Update(dt);
131124
if (State != Hidden) {
125+
if (State == Hiding && FadeAnimation.IsOut()) {
126+
if (LastFocusedMenu != 0) {
127+
UI::FocusedMenu = LastFocusedMenu;
128+
LastFocusedMenu->IsFocused = true;
129+
} else {
130+
UI::FocusedMenu = 0;
131+
}
132+
IsFocused = false;
133+
}
134+
132135
if (FadeAnimation.IsIn()) State = Shown;
133-
if (FadeAnimation.IsOut()) State = Hidden;
136+
if (FadeAnimation.IsOut()) {
137+
State = Hidden;
138+
}
134139

135140
if (IsFocused) {
136141
MessageItems->Update(dt);

0 commit comments

Comments
 (0)