mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 17:17:09 -04:00
Fix chatlines not updating
This commit is contained in:
parent
9c8037b95d
commit
ffb92f652f
@ -12,4 +12,5 @@
|
||||
* Menu inputs (save, edit hotkey, water level, etc) are reset on window resize
|
||||
* Chat input caret is reset on window resize
|
||||
* Position in chat (if you scrolled up into history) is reset on window resize
|
||||
* Two blank lines get shown in chat when you type /client cuboid
|
||||
* Two blank lines get shown in chat when you type /client cuboid
|
||||
* Alt text is closed on window resize
|
@ -2377,8 +2377,8 @@ static void GuiOptionsScreen_SetChatScale(const String* v) { GuiOptionsScreen_Se
|
||||
static void GuiOptionsScreen_GetChatlines(String* v) { String_AppendInt(v, Gui_Chatlines); }
|
||||
static void GuiOptionsScreen_SetChatlines(const String* v) {
|
||||
Gui_Chatlines = Menu_Int(v);
|
||||
HUDScreen_SetChatlines(Gui_Chatlines);
|
||||
Options_Set(OPT_CHATLINES, v);
|
||||
Gui_RefreshHud();
|
||||
}
|
||||
|
||||
static void GuiOptionsScreen_GetUseFont(String* v) { Menu_GetBool(v, !Drawer2D_BitmappedText); }
|
||||
|
@ -740,9 +740,9 @@ static void HUDScreen_ChatInit(struct HUDScreen* s) {
|
||||
s->clientStatusTextures, HUDScreen_GetClientStatus);
|
||||
TextWidget_Make(&s->announcement, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, -Window_Height / 4);
|
||||
|
||||
s->status.placeholderHeight[0] = false; /* Texture pack download status */
|
||||
s->clientStatus.placeholderHeight[0] = false;
|
||||
s->clientStatus.placeholderHeight[1] = false;
|
||||
s->status.collapsible[0] = true; /* Texture pack download status */
|
||||
s->clientStatus.collapsible[0] = true;
|
||||
s->clientStatus.collapsible[1] = true;
|
||||
|
||||
s->chat.underlineUrls = !Game_ClassicMode;
|
||||
s->chatIndex = Chat_Log.count - Gui_Chatlines;
|
||||
@ -1236,6 +1236,14 @@ void HUDScreen_AppendInput(const String* text) {
|
||||
InputWidget_AppendString(&s->input.base, text);
|
||||
}
|
||||
|
||||
void HUDScreen_SetChatlines(int lines) {
|
||||
struct HUDScreen* s = &HUDScreen_Instance;
|
||||
Elem_Free(&s->chat);
|
||||
s->chatIndex += s->chat.lines - lines;
|
||||
s->chat.lines = lines;
|
||||
TextGroupWidget_RedrawAll(&s->chat);
|
||||
}
|
||||
|
||||
struct Widget* HUDScreen_GetHotbar(void) {
|
||||
return (struct Widget*)&HUDScreen_Instance.hotbar;
|
||||
}
|
||||
|
@ -34,5 +34,6 @@ extern struct Screen* LoadingScreen_UNSAFE_RawPointer;
|
||||
void HUDScreen_OpenInput(const String* text);
|
||||
/* Appends text to the chat input in the HUD. */
|
||||
void HUDScreen_AppendInput(const String* text);
|
||||
void HUDScreen_SetChatlines(int lines);
|
||||
struct Widget* HUDScreen_GetHotbar(void);
|
||||
#endif
|
||||
|
@ -2448,7 +2448,7 @@ void TextGroupWidget_Redraw(struct TextGroupWidget* w, int index) {
|
||||
}
|
||||
Drawer2D_ReducePadding_Tex(&tex, w->font->Size, 3);
|
||||
} else {
|
||||
tex.Height = w->placeholderHeight[index] ? w->defaultHeight : 0;
|
||||
tex.Height = w->collapsible[index] ? 0 : w->defaultHeight;
|
||||
}
|
||||
|
||||
tex.X = Gui_CalcPos(w->horAnchor, w->xOffset, tex.Width, Window_Width);
|
||||
@ -2482,7 +2482,7 @@ void TextGroupWidget_SetFont(struct TextGroupWidget* w, FontDesc* font) {
|
||||
w->defaultHeight = height;
|
||||
|
||||
for (i = 0; i < w->lines; i++) {
|
||||
w->textures[i].Height = w->placeholderHeight[i] ? height : 0;
|
||||
w->textures[i].Height = w->collapsible[i] ? 0 : height;
|
||||
}
|
||||
w->font = font;
|
||||
Widget_Reposition(w);
|
||||
@ -2515,11 +2515,8 @@ static const struct WidgetVTABLE TextGroupWidget_VTABLE = {
|
||||
TextGroupWidget_Reposition
|
||||
};
|
||||
void TextGroupWidget_Create(struct TextGroupWidget* w, int lines, struct Texture* textures, TextGroupWidget_Get getLine) {
|
||||
int i;
|
||||
Widget_Reset(w);
|
||||
w->VTABLE = &TextGroupWidget_VTABLE;
|
||||
for (i = 0; i < lines; i++) { w->placeholderHeight[i] = true; }
|
||||
|
||||
w->VTABLE = &TextGroupWidget_VTABLE;
|
||||
w->lines = lines;
|
||||
w->textures = textures;
|
||||
w->GetLine = getLine;
|
||||
|
@ -204,8 +204,8 @@ struct TextGroupWidget {
|
||||
Widget_Layout
|
||||
int lines, defaultHeight;
|
||||
FontDesc* font;
|
||||
/* Whether a line has non-zero height when that line has no text in it. */
|
||||
bool placeholderHeight[TEXTGROUPWIDGET_MAX_LINES];
|
||||
/* Whether a line has zero height when that line has no text in it. */
|
||||
bool collapsible[TEXTGROUPWIDGET_MAX_LINES];
|
||||
bool underlineUrls;
|
||||
struct Texture* textures;
|
||||
TextGroupWidget_Get GetLine;
|
||||
|
Loading…
x
Reference in New Issue
Block a user