View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002985 | FSSCP | HUD | public | 2013-12-21 19:12 | 2015-04-05 23:57 |
Reporter | Lykurgos88 | Assigned To | Yarn | ||
Priority | low | Severity | tweak | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | PC | OS | Windows 7 x64 | OS Version | Service Pack 1 |
Product Version | 3.7.1 | ||||
Fixed in Version | 3.7.2 | ||||
Summary | 0002985: In-game text messages are missing pixels on the left and on the top when scaled beyond 768p | ||||
Description | This 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 Reproduce | Start 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 Information | Contrary 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 | ||||
Tags | No tags attached. | ||||
related to | 0003155 | closed | Some HUD tables break targeting brackets at 4K resolutions |
|
|
|
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. |
|
|
|
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.) |
|
Thank you - the retail EXE screenshot is exactly what I was after :) |
|
|
|
mantis2985.patch (1,826 bytes)
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) |
|
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(). |
|
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. |
|
Fix committed to trunk@10990. |
|
correct attribution |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-12-21 19:12 | Lykurgos88 | New Issue | |
2014-08-13 03:07 | niffiwan | File Added: easier2read-messagebox.png | |
2014-08-13 03:12 | niffiwan | Note Added: 0016205 | |
2014-08-13 03:12 | niffiwan | Assigned To | => niffiwan |
2014-08-13 03:12 | niffiwan | Status | new => assigned |
2014-08-13 04:04 | Yarn | File Added: RetailMessageBox.png | |
2014-08-13 04:15 | Yarn | Note Added: 0016206 | |
2014-08-13 05:17 | niffiwan | Note Added: 0016207 | |
2014-08-13 06:53 | Yarn | File Added: MessageBoxFixed_1440x900.png | |
2014-08-13 06:54 | Yarn | File Added: mantis2985.patch | |
2014-08-13 07:01 | Yarn | Note Added: 0016208 | |
2014-08-13 08:03 | niffiwan | Note Added: 0016209 | |
2014-08-13 08:06 | niffiwan | Changeset attached | => fs2open trunk r10990 |
2014-08-13 08:06 | niffiwan | Note Added: 0016210 | |
2014-08-13 08:06 | niffiwan | Status | assigned => resolved |
2014-08-13 08:06 | niffiwan | Resolution | open => fixed |
2014-08-13 08:06 | niffiwan | Note Added: 0016211 | |
2014-08-13 08:06 | niffiwan | Status | resolved => feedback |
2014-08-13 08:06 | niffiwan | Resolution | fixed => reopened |
2014-08-13 08:06 | niffiwan | Assigned To | niffiwan => Yarn |
2014-08-13 08:06 | niffiwan | Status | feedback => assigned |
2014-08-13 08:07 | niffiwan | Status | assigned => resolved |
2014-08-13 08:07 | niffiwan | Fixed in Version | => 3.7.2 |
2014-08-13 08:07 | niffiwan | Resolution | reopened => fixed |
2015-04-05 23:57 | Yarn | Relationship added | related to 0003155 |