From 90e60654fe6f8410e2becccefd36b38d5d3cab58 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 31 Oct 2019 23:43:58 +0100 Subject: [PATCH] fix rest on the GUI --- SourceX/DiabloUI/art_draw.cpp | 1 + SourceX/DiabloUI/diabloui.cpp | 2 +- SourceX/DiabloUI/text_draw.cpp | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SourceX/DiabloUI/art_draw.cpp b/SourceX/DiabloUI/art_draw.cpp index 04d87b21e..86f8a7679 100644 --- a/SourceX/DiabloUI/art_draw.cpp +++ b/SourceX/DiabloUI/art_draw.cpp @@ -8,6 +8,7 @@ extern unsigned int pal_surface_palette_version; void DrawArt(int screenX, int screenY, Art *art, int nFrame, decltype(SDL_Rect().w) srcW, decltype(SDL_Rect().h) srcH) { + screenX += PANEL_LEFT; if (screenY >= SCREEN_Y + SCREEN_HEIGHT || screenX >= SCREEN_X + SCREEN_WIDTH || art->surface == nullptr) return; diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index 0f2984313..8276fad3b 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -483,7 +483,7 @@ BOOL UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc) int GetCenterOffset(int w, int bw) { if (bw == 0) { - bw = SCREEN_WIDTH; + bw = PANEL_WIDTH; } return (bw - w) / 2; diff --git a/SourceX/DiabloUI/text_draw.cpp b/SourceX/DiabloUI/text_draw.cpp index 58f8efd49..43fe917ff 100644 --- a/SourceX/DiabloUI/text_draw.cpp +++ b/SourceX/DiabloUI/text_draw.cpp @@ -32,10 +32,13 @@ int AlignXOffset(int flags, const SDL_Rect &dest, int w) } // namespace -void DrawTTF(const char *text, const SDL_Rect &rect, int flags, +void DrawTTF(const char *text, const SDL_Rect &rectIn, int flags, const SDL_Color &text_color, const SDL_Color &shadow_color, TtfSurfaceCache **render_cache) { + SDL_Rect rect(rectIn); + if(! (flags & UIS_CENTER)) + rect.x += PANEL_LEFT; if (font == nullptr || text == nullptr || *text == '\0') return; if (*render_cache == nullptr) {