From 659de5d2d8e4f2e1ec31526b4de329a85ea2a425 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Thu, 28 Mar 2019 02:13:52 +0100 Subject: [PATCH] Silence "truncation of floating point value" warnings in gzdoom.pk3. --- wadsrc/static/zscript/ui/menu/loadsavemenu.zs | 8 ++++---- .../zscript/ui/statscreen/statscreen_coop.zs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs index 02375e6b4f..d30f3c9bac 100644 --- a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs +++ b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs @@ -127,7 +127,7 @@ class LoadSaveMenu : ListMenu savepicHeight = 135*screen.GetHeight() / 400; FontScale = max(screen.GetHeight() / 480, 1); - rowHeight = max((NewConsoleFont.GetHeight() + 1) * FontScale, 1); + rowHeight = int(max((NewConsoleFont.GetHeight() + 1) * FontScale, 1)); listboxLeft = savepicLeft + savepicWidth + 14; listboxTop = savepicTop; @@ -216,7 +216,7 @@ class LoadSaveMenu : ListMenu if (manager.SavegameCount() == 0) { String text = Stringtable.Localize("$MNU_NOFILES"); - int textlen = NewConsoleFont.StringWidth(text) * FontScale; + int textlen = int(NewConsoleFont.StringWidth(text) * FontScale); screen.DrawText (NewConsoleFont, Font.CR_GOLD, (listboxLeft+(listboxWidth-textlen)/2) / FontScale, (listboxTop+(listboxHeight-rowHeight)/2) / FontScale, text, DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); @@ -259,7 +259,7 @@ class LoadSaveMenu : ListMenu else { String s = mInput.GetText() .. NewConsoleFont.GetCursor(); - int length = NewConsoleFont.StringWidth(s) * FontScale; + int length = int(NewConsoleFont.StringWidth(s) * FontScale); int displacement = min(0, listboxWidth - 2 - length); screen.DrawText (NewConsoleFont, Font.CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, s, DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); @@ -277,7 +277,7 @@ class LoadSaveMenu : ListMenu void UpdateSaveComment() { - BrokenSaveComment = NewConsoleFont.BreakLines(manager.SaveCommentString, commentWidth / FontScale); + BrokenSaveComment = NewConsoleFont.BreakLines(manager.SaveCommentString, int(commentWidth / FontScale)); } //============================================================================= diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs b/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs index 3c19243d45..3dc494d176 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs @@ -21,7 +21,7 @@ class CoopStatusScreen : StatusScreen ng_state = 1; displayFont = NewSmallFont; FontScale = max(screen.GetHeight() / 480, 1); - RowHeight = max((displayFont.GetHeight() + 1) * FontScale, 1); + RowHeight = int(max((displayFont.GetHeight() + 1) * FontScale, 1)); cnt_pause = Thinker.TICRATE; @@ -229,7 +229,7 @@ class CoopStatusScreen : StatusScreen Vector2 readyoffset = TexMan.GetScaledOffset(readyico); height = int(readysize.Y - readyoffset.Y); maxiconheight = MAX(height, maxiconheight); - height = displayFont.GetHeight() * FontScale; + height = int(displayFont.GetHeight() * FontScale); lineheight = MAX(height, maxiconheight * CleanYfac); ypadding = (lineheight - height + 1) / 2; y += CleanYfac; @@ -238,11 +238,11 @@ class CoopStatusScreen : StatusScreen text_secret = Stringtable.Localize("$SCORE_SECRET"); text_kills = Stringtable.Localize("$SCORE_KILLS"); - icon_x = 8 * FontScale; - name_x = icon_x + maxscorewidth * FontScale; - kills_x = name_x + (maxnamewidth + 1 + MAX(displayFont.StringWidth("XXXXXXXXXX"), displayFont.StringWidth(text_kills)) + 16) * FontScale; - bonus_x = kills_x + ((bonus_len = displayFont.StringWidth(text_bonus)) + 16) * FontScale; - secret_x = bonus_x + ((secret_len = displayFont.StringWidth(text_secret)) + 16) * FontScale; + icon_x = int(8 * FontScale); + name_x = int(icon_x + maxscorewidth * FontScale); + kills_x = int(name_x + (maxnamewidth + 1 + MAX(displayFont.StringWidth("XXXXXXXXXX"), displayFont.StringWidth(text_kills)) + 16) * FontScale); + bonus_x = int(kills_x + ((bonus_len = displayFont.StringWidth(text_bonus)) + 16) * FontScale); + secret_x = int(bonus_x + ((secret_len = displayFont.StringWidth(text_secret)) + 16) * FontScale); x = (screen.GetWidth() - secret_x) >> 1; icon_x += x; @@ -256,7 +256,7 @@ class CoopStatusScreen : StatusScreen drawTextScaled(displayFont, kills_x - displayFont.StringWidth(text_kills) * FontScale, y, text_kills, FontScale, textcolor); drawTextScaled(displayFont, bonus_x - bonus_len * FontScale, y, text_bonus, FontScale, textcolor); drawTextScaled(displayFont, secret_x - secret_len * FontScale, y, text_secret, FontScale, textcolor); - y += height + 6 * FontScale; + y += int(height + 6 * FontScale); missed_kills = wbs.maxkills; missed_items = wbs.maxitems;