Skip to content

Commit

Permalink
set gfnListDelete in UiInitScrollBar
Browse files Browse the repository at this point in the history
  • Loading branch information
pionere committed Sep 27, 2023
1 parent 996d9e9 commit a1fa588
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
7 changes: 4 additions & 3 deletions Source/DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct ScrollBarState {
} ScrollBarState;
static ScrollBarState scrollBarState;

void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnSelect)(unsigned index), void (*fnEsc)(), bool (*fnDelete)())
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnSelect)(unsigned index), void (*fnEsc)())
{
gUiDrawCursor = true;
SelectedItem = 0;
Expand All @@ -72,7 +72,7 @@ void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnS
gfnListFocus = fnFocus;
gfnListSelect = fnSelect;
gfnListEsc = fnEsc;
gfnListDelete = fnDelete;
gfnListDelete = NULL;
#if SCREEN_READER_INTEGRATION
if (gUIListItems.size() > SelectedItem) {
SpeakText(gUIListItems[SelectedItem]->m_text);
Expand All @@ -87,8 +87,9 @@ void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnS
#endif
}

void UiInitScrollBar(UiScrollBar* uiSb, unsigned viewportSize)
void UiInitScrollBar(UiScrollBar* uiSb, unsigned viewportSize, bool (*fnDelete)())
{
gfnListDelete = fnDelete;
ListViewportSize = viewportSize;
if (ListViewportSize > SelectedItemMax) {
uiSb->m_iFlags |= UIS_HIDDEN;
Expand Down
4 changes: 2 additions & 2 deletions Source/DiabloUI/diabloui.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void UiAddLogo(std::vector<UiItemBase*>* vecDialog);
void UiFocusNavigationSelect();
void UiFocusNavigationEsc();
void UiFocusNavigationDelete();
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index) = NULL, void (*fnSelect)(unsigned index) = NULL, void (*fnEsc)() = NULL, bool (*fnDelete)() = NULL);
void UiInitScrollBar(UiScrollBar* ui_sb, unsigned viewport_size);
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index) = NULL, void (*fnSelect)(unsigned index) = NULL, void (*fnEsc)() = NULL);
void UiInitScrollBar(UiScrollBar* ui_sb, unsigned viewport_size, bool (*fnDelete)());
void UiInitEdit(UiEdit* ui_edit);
void UiClearScreen();
void UiRenderAndPoll();
Expand Down
4 changes: 2 additions & 2 deletions Source/DiabloUI/selhero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ static void SelheroListInit()
SDL_Rect rect6 = { SELHERO_RPANEL_LEFT + 2 * SELHERO_RPANEL_WIDTH / 3, SELHERO_RBUTTON_TOP, SELHERO_RPANEL_WIDTH / 3, 35 };
gUiItems.push_back(new UiTxtButton("Cancel", &UiFocusNavigationEsc, rect6, UIS_CENTER | UIS_VCENTER | UIS_BIG | UIS_GOLD));

UiInitScreen(selhero_SaveCount + 1, SelheroListFocus, SelheroListSelect, SelheroListEsc, SelheroListDelete);
UiInitScrollBar(scrollBar, MAX_VIEWPORT_ITEMS);
UiInitScreen(selhero_SaveCount + 1, SelheroListFocus, SelheroListSelect, SelheroListEsc);
UiInitScrollBar(scrollBar, MAX_VIEWPORT_ITEMS, SelheroListDelete);
}

static void SelheroClassSelectorEsc()
Expand Down
7 changes: 4 additions & 3 deletions tools/patcher/DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ typedef struct ScrollBarState {
} ScrollBarState;
static ScrollBarState scrollBarState;

void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnSelect)(unsigned index), void (*fnEsc)(), bool (*fnDelete)())
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnSelect)(unsigned index), void (*fnEsc)())
{
gUiDrawCursor = true;
SelectedItem = 0;
Expand All @@ -73,7 +73,7 @@ void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnS
gfnListFocus = fnFocus;
gfnListSelect = fnSelect;
gfnListEsc = fnEsc;
gfnListDelete = fnDelete;
gfnListDelete = NULL;
#if SCREEN_READER_INTEGRATION
if (gUIListItems.size() > SelectedItem) {
SpeakText(gUIListItems[SelectedItem]->m_text);
Expand All @@ -90,8 +90,9 @@ void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index), void (*fnS
#endif
}
#if FULL_UI
void UiInitScrollBar(UiScrollBar* uiSb, unsigned viewportSize)
void UiInitScrollBar(UiScrollBar* uiSb, unsigned viewportSize, bool (*fnDelete)())
{
gfnListDelete = fnDelete;
ListViewportSize = viewportSize;
if (ListViewportSize > SelectedItemMax) {
uiSb->m_iFlags |= UIS_HIDDEN;
Expand Down
4 changes: 2 additions & 2 deletions tools/patcher/DiabloUI/diabloui.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void UiFocus(unsigned itemIndex);
void UiFocusNavigationSelect();
void UiFocusNavigationEsc();
void UiFocusNavigationDelete();
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index) = NULL, void (*fnSelect)(unsigned index) = NULL, void (*fnEsc)() = NULL, bool (*fnDelete)() = NULL);
void UiInitScreen(unsigned listSize, void (*fnFocus)(unsigned index) = NULL, void (*fnSelect)(unsigned index) = NULL, void (*fnEsc)() = NULL);
#if FULL_UI
void UiInitScrollBar(UiScrollBar* ui_sb, unsigned viewport_size);
void UiInitScrollBar(UiScrollBar* ui_sb, unsigned viewport_size, bool (*fnDelete)());
void UiInitEdit(UiEdit* ui_edit);
#endif
void UiClearScreen();
Expand Down

0 comments on commit a1fa588

Please sign in to comment.