2019-12-10 03:15 EST


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002985FSSCPHUDpublic2015-04-05 19:57
ReporterLykurgos88 
Assigned ToYarn 
PrioritylowSeveritytweakReproducibilityalways
StatusresolvedResolutionfixed 
PlatformPCOSWindows 7 x64OS VersionService Pack 1
Product Version3.7.1 
Target VersionFixed in Version3.7.2 
Summary0002985: In-game text messages are missing pixels on the left and on the top when scaled beyond 768p
DescriptionThis is related to the in-game message screen. The invisible box, that is supposed to contain 3 lines at a time, is a bit too small on the left and on the top. This effectively means that some pixels on the left and on the top disappear even though there seems to be a enough room to render. Either the message box gauge is scaled badly, or the text itself is scaled badly.

Only the resolutions consisting of 768 vertical pixels seem to scale the text properly. Everything else has a text scaling problem. Aspect Ratio doesn't matter, only the amount of vertical pixel matters (text is scaled according to vertical pixels).

See the definitive comparison of resolutions here: http://www.hard-light.net/forums/index.php?topic=86173.msg1722307#msg1722307
Steps To ReproduceStart the mission "Surrender, Belisarius!". Wait for Alpha 2 to say 2 lines and then take a screenshot (message box should have 3 lines rendered).
Additional InformationContrary to the initial guess, text font style does NOT have an effect on this issue.

See this thread: http://www.hard-light.net/forums/index.php?topic=86173.0
TagsNo tags attached.
Attached Files
  • png file icon easier2read-messagebox.png (493,103 bytes) 2014-08-12 23:07
  • png file icon RetailMessageBox.png (172,210 bytes) 2014-08-13 00:04 -
    png file icon RetailMessageBox.png (172,210 bytes) 2014-08-13 00:04 +
  • png file icon MessageBoxFixed_1440x900.png (55,037 bytes) 2014-08-13 02:53 -
    png file icon MessageBoxFixed_1440x900.png (55,037 bytes) 2014-08-13 02:53 +
  • patch file icon mantis2985.patch (1,826 bytes) 2014-08-13 02:54 -
    Index: code/graphics/2d.cpp
    ===================================================================
    --- code/graphics/2d.cpp	(revision 10989)
    +++ code/graphics/2d.cpp	(working copy)
    @@ -230,7 +230,7 @@
     			xy_tmp = (*x) * Gr_resize_X;
     			break;
     		}
    -		(*x) = fl2i(xy_tmp);
    +		(*x) = fl2ir(xy_tmp);
     	}
     
     	if ( y ) {
    @@ -251,17 +251,17 @@
     			xy_tmp = (*y) * Gr_resize_Y;
     			break;
     		}
    -		(*y) = fl2i(xy_tmp);
    +		(*y) = fl2ir(xy_tmp);
     	}
     
     	if ( w ) {
     		xy_tmp = (*w) * ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_X : Gr_resize_X);
    -		(*w) = fl2i(xy_tmp);
    +		(*w) = fl2ir(xy_tmp);
     	}
     
     	if ( h ) {
     		xy_tmp = (*h) * ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_Y : Gr_resize_Y);
    -		(*h) = fl2i(xy_tmp);
    +		(*h) = fl2ir(xy_tmp);
     	}
     
     	return true;
    @@ -302,7 +302,7 @@
     			xy_tmp = (*x) / Gr_resize_X;
     			break;
     		}
    -		(*x) = fl2i(xy_tmp);
    +		(*x) = fl2ir(xy_tmp);
     	}
     
     	if ( y ) {
    @@ -323,17 +323,17 @@
     			xy_tmp = (*y) / Gr_resize_Y;
     			break;
     		}
    -		(*y) = fl2i(xy_tmp);
    +		(*y) = fl2ir(xy_tmp);
     	}
     
     	if ( w ) {
     		xy_tmp = (*w) / ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_X : Gr_resize_X);
    -		(*w) = fl2i(xy_tmp);
    +		(*w) = fl2ir(xy_tmp);
     	}
     
     	if ( h ) {
     		xy_tmp = (*h) / ((resize_mode == GR_RESIZE_FULL) ? Gr_full_resize_Y : Gr_resize_Y);
    -		(*h) = fl2i(xy_tmp);
    +		(*h) = fl2ir(xy_tmp);
     	}
     
     	return true;
    Index: code/math/floating.h
    ===================================================================
    --- code/math/floating.h	(revision 10989)
    +++ code/math/floating.h	(working copy)
    @@ -29,6 +29,7 @@
     #define fl_abs(fl) fabsf(fl)
     #define i2fl(i) ((float)(i))
     #define fl2i(fl) ((int)(fl))
    +#define fl2ir(fl) ((int)(fl + ((fl < 0.0f) ? -0.5f : 0.5f)))
     #define flceil(fl) (int)ceil(fl)
     #define flfloor(fl) (int)floor(fl)
     #define f2fl(fx) ((float)(fx)/65536.0f)
    
    patch file icon mantis2985.patch (1,826 bytes) 2014-08-13 02:54 +

-Relationships
related to 0003155new Some HUD tables break targeting brackets at 4K resolutions 
+Relationships

-Notes

~0016205

niffiwan (developer)

As part of something else I was working on, I think I've found the reason for this issue - the text is positioned incorrectly meaning that it's running into a "clip" region. Having said that, if you look at the attached pic of a partial fix you can see that there's a 4th line of text at the top of the gauge, mostly cut-off by the same clipping region that caused this issue. Could you please check & post a screenshot of what happens in retail at this point? i.e. when there's 4 lines of text recently added to the message box? I'd like to know if it only ever showed three lines of text, or whether it also had the 4th line cut-off.

~0016206

Yarn (developer)

I know you weren't addressing me specifically, but I thought I'd upload the screenshot that you want, which was taken with the retail EXE (that IS what you want, right?). You can see that there are three lines there and no cut-off fourth line, and the top line is clearly the last part of a previous message.

I'm not 100% certain, but this sounds like it may be caused by float-to-int truncation. If that's the case, then this can probably be fixed by adding 0.5 to the X and Y coordinates before converting them to ints. (And this kind of thing can also fix a number of other minor graphical bugs that I've noticed, like the main hall tooltip shading being a pixel too high in some resolutions.)

~0016207

niffiwan (developer)

Thank you - the retail EXE screenshot is exactly what I was after :)

~0016208

Yarn (developer)

It turns out I was right: float-to-int truncation was the problem. The attached patch fixes the problem by adding fl2ir() (which is just fl2i() with some simple rounding) and changing gr_resize_screen_pos() and gr_unsize_screen_pos() (where the problem was happening) to use the new define. If any other parts of the code are found to have similar rounding issues when casting to int or using fl2i(), they can also use fl2ir().

~0016209

niffiwan (developer)

Thank you again! That has fixed the issue in my tests @ vertical resolutions of 1080, 1050, 1024 & 900 (didn't bother with the rest since they were all OK). I'll commit shortly.

~0016210

niffiwan (developer)

Fix committed to trunk@10990.

~0016211

niffiwan (developer)

correct attribution
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2013-12-21 14:12 Lykurgos88 New Issue
2014-08-12 23:07 niffiwan File Added: easier2read-messagebox.png
2014-08-12 23:12 niffiwan Note Added: 0016205
2014-08-12 23:12 niffiwan Assigned To => niffiwan
2014-08-12 23:12 niffiwan Status new => assigned
2014-08-13 00:04 Yarn File Added: RetailMessageBox.png
2014-08-13 00:15 Yarn Note Added: 0016206
2014-08-13 01:17 niffiwan Note Added: 0016207
2014-08-13 02:53 Yarn File Added: MessageBoxFixed_1440x900.png
2014-08-13 02:54 Yarn File Added: mantis2985.patch
2014-08-13 03:01 Yarn Note Added: 0016208
2014-08-13 04:03 niffiwan Note Added: 0016209
2014-08-13 04:06 niffiwan Changeset attached => fs2open trunk r10990
2014-08-13 04:06 niffiwan Note Added: 0016210
2014-08-13 04:06 niffiwan Status assigned => resolved
2014-08-13 04:06 niffiwan Resolution open => fixed
2014-08-13 04:06 niffiwan Note Added: 0016211
2014-08-13 04:06 niffiwan Status resolved => feedback
2014-08-13 04:06 niffiwan Resolution fixed => reopened
2014-08-13 04:06 niffiwan Assigned To niffiwan => Yarn
2014-08-13 04:06 niffiwan Status feedback => assigned
2014-08-13 04:07 niffiwan Status assigned => resolved
2014-08-13 04:07 niffiwan Fixed in Version => 3.7.2
2014-08-13 04:07 niffiwan Resolution reopened => fixed
2015-04-05 19:57 Yarn Relationship added related to 0003155
+Issue History