diff --git a/SourceX/DiabloUI/art_draw.cpp b/SourceX/DiabloUI/art_draw.cpp index 6c0a64812..6c8e06b21 100644 --- a/SourceX/DiabloUI/art_draw.cpp +++ b/SourceX/DiabloUI/art_draw.cpp @@ -6,17 +6,16 @@ namespace dvl { extern SDL_Surface *pal_surface; 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) +void DrawArt(int screenX, int screenY, Art *art, int nFrame, Uint16 srcW, Uint16 srcH) { if (screenY >= SCREEN_HEIGHT || screenX >= SCREEN_WIDTH || art->surface == NULL) return; SDL_Rect src_rect = { 0, - static_cast(nFrame * art->h()), - static_cast(art->w()), - static_cast(art->h()) + static_cast(nFrame * art->h()), + static_cast(art->w()), + static_cast(art->h()) }; ScaleOutputRect(&src_rect); diff --git a/SourceX/DiabloUI/art_draw.h b/SourceX/DiabloUI/art_draw.h index 03c14cc46..f1de5ec14 100644 --- a/SourceX/DiabloUI/art_draw.h +++ b/SourceX/DiabloUI/art_draw.h @@ -6,8 +6,7 @@ namespace dvl { -void DrawArt(int screenX, int screenY, Art *art, int nFrame = 0, - decltype(SDL_Rect().w) srcW = 0, decltype(SDL_Rect().h) srcH = 0); +void DrawArt(int screenX, int screenY, Art *art, int nFrame = 0, Uint16 srcW = 0, Uint16 srcH = 0); void DrawAnimatedArt(Art *art, int screenX, int screenY); diff --git a/SourceX/DiabloUI/button.h b/SourceX/DiabloUI/button.h index 58ae3c821..e1412b7c8 100644 --- a/SourceX/DiabloUI/button.h +++ b/SourceX/DiabloUI/button.h @@ -11,11 +11,11 @@ inline void UnloadSmlButtonArt() { SmlButton.Unload(); } -constexpr decltype(SDL_Rect().w) SML_BUTTON_WIDTH = 110; -constexpr decltype(SDL_Rect().h) SML_BUTTON_HEIGHT = 28; +const Uint16 SML_BUTTON_WIDTH = 110; +const Uint16 SML_BUTTON_HEIGHT = 28; constexpr UiButton MakeSmlButton( - const char *text, void (*action)(), decltype(SDL_Rect().x) x, decltype(SDL_Rect().y) y, int flags = 0) + const char *text, void (*action)(), Sint16 x, Sint16 y, int flags = 0) { return UiButton( &SmlButton, diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index 974a80c16..b1265ad3e 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -47,7 +47,7 @@ struct CachedLine { std::size_t index; SurfacePtr surface; - decltype(pal_surface_palette_version) palette_version; + unsigned int palette_version; }; SurfacePtr RenderText(const char *text, SDL_Color color) @@ -197,7 +197,7 @@ public: private: LinesBuffer lines_; bool finished_; - decltype(SDL_GetTicks()) ticks_begin_; + Uint32 ticks_begin_; int prev_offset_y_; }; @@ -234,7 +234,7 @@ void CreditsRenderer::Render() SDL_SetClipRect(GetOutputSurface(), &viewport); // We use unscaled coordinates for calculation throughout. - decltype(SDL_Rect().y) dest_y = VIEWPORT.y - (offset_y - lines_begin * LINE_H); + Sint16 dest_y = VIEWPORT.y - (offset_y - lines_begin * LINE_H); for (std::size_t i = 0; i < lines_.size(); ++i, dest_y += LINE_H) { auto &line = lines_[i]; if (line.surface == NULL) @@ -244,7 +244,7 @@ void CreditsRenderer::Render() if (line.palette_version != pal_surface_palette_version) line = PrepareLine(line.index); - decltype(SDL_Rect().x) dest_x = PANEL_LEFT + VIEWPORT.x + 31; + Sint16 dest_x = PANEL_LEFT + VIEWPORT.x + 31; if (CREDITS_LINES[line.index][0] == '\t') dest_x += 40; diff --git a/SourceX/DiabloUI/progress.cpp b/SourceX/DiabloUI/progress.cpp index 85463ee57..1099ac89f 100644 --- a/SourceX/DiabloUI/progress.cpp +++ b/SourceX/DiabloUI/progress.cpp @@ -81,8 +81,8 @@ void progress_Render(BYTE progress) if (msgSurface) { SDL_Rect dsc_rect = { - static_cast(x + 50), - static_cast(y + 8), + static_cast(x + 50), + static_cast(y + 8), msgSurface->w, msgSurface->h }; diff --git a/SourceX/DiabloUI/scrollbar.h b/SourceX/DiabloUI/scrollbar.h index 76a479b14..c5f1a3fd6 100644 --- a/SourceX/DiabloUI/scrollbar.h +++ b/SourceX/DiabloUI/scrollbar.h @@ -6,7 +6,7 @@ namespace dvl { extern Art ArtScrollBarBackground; -const decltype(SDL_Rect().w) SCROLLBAR_BG_WIDTH = 25; +const Uint16 SCROLLBAR_BG_WIDTH = 25; extern Art ArtScrollBarArrow; enum class ScrollBarArrowFrame { @@ -17,7 +17,7 @@ enum class ScrollBarArrowFrame { }; extern Art ArtScrollBarThumb; -const decltype(SDL_Rect().w) SCROLLBAR_ARROW_WIDTH = 25; +const Uint16 SCROLLBAR_ARROW_WIDTH = 25; inline SDL_Rect UpArrowRect(const UiScrollBar &sb) { @@ -25,7 +25,7 @@ inline SDL_Rect UpArrowRect(const UiScrollBar &sb) sb.rect.x, sb.rect.y, SCROLLBAR_ARROW_WIDTH, - static_cast(sb.arrow->h()), + static_cast(sb.arrow->h()), }; } @@ -33,13 +33,13 @@ inline SDL_Rect DownArrowRect(const UiScrollBar &sb) { return { sb.rect.x, - static_cast(sb.rect.y + sb.rect.h - sb.arrow->h()), + static_cast(sb.rect.y + sb.rect.h) - sb.arrow->h(), SCROLLBAR_ARROW_WIDTH, - static_cast(sb.arrow->h()), + static_cast(sb.arrow->h()), }; } -inline decltype(SDL_Rect().h) BarHeight(const UiScrollBar &sb) +inline Uint16 BarHeight(const UiScrollBar &sb) { return sb.rect.h - 2 * sb.arrow->h(); } @@ -48,7 +48,7 @@ inline SDL_Rect BarRect(const UiScrollBar &sb) { return { sb.rect.x, - static_cast(sb.rect.y + sb.arrow->h()), + static_cast(sb.rect.y + sb.arrow->h()), SCROLLBAR_BG_WIDTH, BarHeight(sb), }; @@ -60,10 +60,10 @@ inline SDL_Rect ThumbRect(const UiScrollBar &sb, std::size_t selected_index, std const int thumb_max_y = BarHeight(sb) - sb.thumb->h(); const int thumb_y = (selected_index * thumb_max_y / (num_items - 1)); return { - static_cast(sb.rect.x + THUMB_OFFSET_X), - static_cast(sb.rect.y + sb.arrow->h() + thumb_y), - static_cast(sb.rect.w - THUMB_OFFSET_X), - static_cast(sb.thumb->h()), + static_cast(sb.rect.x + THUMB_OFFSET_X), + static_cast(sb.rect.y + sb.arrow->h() + thumb_y), + static_cast(sb.rect.w - THUMB_OFFSET_X), + static_cast(sb.thumb->h()), }; } diff --git a/SourceX/DiabloUI/ttf_render_wrapped.cpp b/SourceX/DiabloUI/ttf_render_wrapped.cpp index a8891a6e8..18351ce27 100644 --- a/SourceX/DiabloUI/ttf_render_wrapped.cpp +++ b/SourceX/DiabloUI/ttf_render_wrapped.cpp @@ -149,8 +149,8 @@ SDL_Surface *RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, SDL_Colo SDL_stack_free(str); return NULL; } - dest.w = static_cast(tmp->w); - dest.h = static_cast(tmp->h); + dest.w = static_cast(tmp->w); + dest.h = static_cast(tmp->h); switch (x_align) { case TextAlignment_END: diff --git a/SourceX/DiabloUI/ui_item.h b/SourceX/DiabloUI/ui_item.h index 219f4559a..7a57e96c0 100644 --- a/SourceX/DiabloUI/ui_item.h +++ b/SourceX/DiabloUI/ui_item.h @@ -195,12 +195,12 @@ struct UiList : public UiItemBase { template constexpr UiList( UiListItem (&items)[N], - decltype(SDL_Rect().x) x, - decltype(SDL_Rect().y) y, - decltype(SDL_Rect().w) item_width, - decltype(SDL_Rect().h) item_height, + Sint16 x, + Sint16 y, + Uint16 item_width, + Uint16 item_height, int flags) - : UiItemBase({ x, y, item_width, static_cast(item_height * N) }, flags) + : UiItemBase({ x, y, item_width, static_cast(item_height * N) }, flags) , x(x) , y(y) , item_width(item_width) @@ -210,19 +210,19 @@ struct UiList : public UiItemBase { { } - decltype(SDL_Rect().x) x; - decltype(SDL_Rect().y) y; - decltype(SDL_Rect().w) item_width; - decltype(SDL_Rect().h) item_height; + Sint16 x; + Sint16 y; + Uint16 item_width; + Uint16 item_height; UiListItem *items; std::size_t length; SDL_Rect itemRect(std::size_t i) const { - return { x, static_cast(y + item_height * i), item_width, item_height }; + return { x, static_cast(y + item_height * i), item_width, item_height }; } - UiListItem *itemAt(decltype(SDL_Rect().y) y) const + UiListItem *itemAt(Sint16 y) const { ASSERT(y >= rect.y); const std::size_t index = (y - rect.y) / item_height; diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 39f6417d0..52370f706 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -719,14 +719,14 @@ BOOL SVidPlayContinue(void) } else { factor = wFactor; } - const int scaledW = SVidWidth * factor; - const int scaledH = SVidHeight * factor; + const Sint16 scaledW = SVidWidth * factor; + const Sint16 scaledH = SVidHeight * factor; SDL_Rect pal_surface_offset = { - static_cast((output_surface->w - scaledW) / 2), - static_cast((output_surface->h - scaledH) / 2), - static_cast(scaledW), - static_cast(scaledH) + (output_surface->w - scaledW) / 2, + (output_surface->h - scaledH) / 2, + scaledW, + scaledH }; if (factor == 1) { if (SDL_BlitSurface(SVidSurface, NULL, output_surface, &pal_surface_offset) <= -1) {