Skip to content

Commit e5d4d31

Browse files
authored
Fix dialog option bounding box (#454)
1 parent fa1621f commit e5d4d31

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/game_dialog.cc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ typedef struct GameDialogOptionEntry {
103103
int reaction;
104104
int proc;
105105
int btn;
106-
int field_14;
106+
int top;
107107
char text[900];
108-
int field_39C;
108+
int bottom;
109109
} GameDialogOptionEntry;
110110

111111
// Provides button configuration for party member combat control and
@@ -2106,9 +2106,9 @@ void gameDialogOptionOnMouseEnter(int index)
21062106
}
21072107

21082108
_optionRect.left = 0;
2109-
_optionRect.top = dialogOptionEntry->field_14;
2109+
_optionRect.top = dialogOptionEntry->top;
21102110
_optionRect.right = 391;
2111-
_optionRect.bottom = dialogOptionEntry->field_39C;
2111+
_optionRect.bottom = dialogOptionEntry->bottom;
21122112
_gDialogRefreshOptionsRect(gGameDialogOptionsWindow, &_optionRect);
21132113

21142114
_optionRect.left = 5;
@@ -2143,7 +2143,7 @@ void gameDialogOptionOnMouseEnter(int index)
21432143

21442144
_optionRect.left = 0;
21452145
_optionRect.right = 391;
2146-
_optionRect.top = dialogOptionEntry->field_14;
2146+
_optionRect.top = dialogOptionEntry->top;
21472147
windowRefreshRect(gGameDialogOptionsWindow, &_optionRect);
21482148
}
21492149

@@ -2153,9 +2153,9 @@ void gameDialogOptionOnMouseExit(int index)
21532153
GameDialogOptionEntry* dialogOptionEntry = &(gDialogOptionEntries[index]);
21542154

21552155
_optionRect.left = 0;
2156-
_optionRect.top = dialogOptionEntry->field_14;
2156+
_optionRect.top = dialogOptionEntry->top;
21572157
_optionRect.right = 391;
2158-
_optionRect.bottom = dialogOptionEntry->field_39C;
2158+
_optionRect.bottom = dialogOptionEntry->bottom;
21592159
_gDialogRefreshOptionsRect(gGameDialogOptionsWindow, &_optionRect);
21602160

21612161
int color = _colorTable[992] | 0x2000000;
@@ -2190,7 +2190,7 @@ void gameDialogOptionOnMouseExit(int index)
21902190
color);
21912191

21922192
_optionRect.right = 391;
2193-
_optionRect.top = dialogOptionEntry->field_14;
2193+
_optionRect.top = dialogOptionEntry->top;
21942194
_optionRect.left = 0;
21952195
windowRefreshRect(gGameDialogOptionsWindow, &_optionRect);
21962196
}
@@ -2333,12 +2333,12 @@ void _gdProcessUpdate()
23332333
}
23342334
}
23352335

2336-
int v11 = _text_num_lines(dialogOptionEntry->text, _optionRect.right - _optionRect.left) * fontGetLineHeight() + _optionRect.top + 2;
2337-
if (v11 < _optionRect.bottom) {
2336+
int estimate = _text_num_lines(dialogOptionEntry->text, _optionRect.right - _optionRect.left) * fontGetLineHeight() + _optionRect.top + 2;
2337+
if (estimate < _optionRect.bottom) {
23382338
int y = _optionRect.top;
23392339

2340-
dialogOptionEntry->field_39C = v11;
2341-
dialogOptionEntry->field_14 = y;
2340+
dialogOptionEntry->bottom = estimate;
2341+
dialogOptionEntry->top = y;
23422342

23432343
if (index == 0) {
23442344
y = 0;
@@ -2353,6 +2353,7 @@ void _gdProcessUpdate()
23532353
393,
23542354
color);
23552355

2356+
dialogOptionEntry->bottom = _optionRect.top;
23562357
_optionRect.top += 2;
23572358

23582359
dialogOptionEntry->btn = buttonCreate(gGameDialogOptionsWindow, 2, y, width, _optionRect.top - y - 4, 1200 + index, 1300 + index, -1, 49 + index, nullptr, nullptr, nullptr, 0);

0 commit comments

Comments
 (0)