@@ -1832,7 +1832,7 @@ void AM_Drawer()
1832
1832
1833
1833
if (!(viewactive && am_overlay < 2 ) && !hu_font[0 ].empty ())
1834
1834
{
1835
- char line[ 64 + 10 ] ;
1835
+ std::string line;
1836
1836
const int time = level.time / TICRATE;
1837
1837
1838
1838
const int text_height = (W_ResolvePatchHandle (hu_font[0 ])->height () + 1 ) * CleanYfac;
@@ -1842,12 +1842,12 @@ void AM_Drawer()
1842
1842
{
1843
1843
if (am_showmonsters)
1844
1844
{
1845
- sprintf (line, TEXTCOLOR_RED " MONSTERS:" TEXTCOLOR_NORMAL " %d / %d" ,
1845
+ StrFormat (line, TEXTCOLOR_RED " MONSTERS:" TEXTCOLOR_NORMAL " %d / %d" ,
1846
1846
level.killed_monsters ,
1847
1847
(level.total_monsters + level.respawned_monsters ));
1848
1848
1849
1849
int x, y;
1850
- const int text_width = V_StringWidth (line) * CleanXfac;
1850
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1851
1851
1852
1852
if (AM_OverlayAutomapVisible ())
1853
1853
{
@@ -1860,17 +1860,17 @@ void AM_Drawer()
1860
1860
y = OV_Y - (text_height * 2 ) + 1 ;
1861
1861
}
1862
1862
1863
- screen->DrawTextClean (CR_GREY, x, y, line);
1863
+ screen->DrawTextClean (CR_GREY, x, y, line. c_str () );
1864
1864
}
1865
1865
1866
1866
if (am_showitems)
1867
1867
{
1868
- sprintf (line, TEXTCOLOR_RED " ITEMS:" TEXTCOLOR_NORMAL " %d / %d" ,
1868
+ StrFormat (line, TEXTCOLOR_RED " ITEMS:" TEXTCOLOR_NORMAL " %d / %d" ,
1869
1869
level.found_items ,
1870
1870
level.total_items );
1871
1871
1872
1872
int x, y;
1873
- const int text_width = V_StringWidth (line) * CleanXfac;
1873
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1874
1874
1875
1875
if (AM_OverlayAutomapVisible ())
1876
1876
{
@@ -1883,15 +1883,15 @@ void AM_Drawer()
1883
1883
y = OV_Y - (text_height * 3 ) + 1 ;
1884
1884
}
1885
1885
1886
- screen->DrawTextClean (CR_GREY, x, y, line);
1886
+ screen->DrawTextClean (CR_GREY, x, y, line. c_str () );
1887
1887
}
1888
1888
1889
1889
if (am_showsecrets)
1890
1890
{
1891
- sprintf (line, TEXTCOLOR_RED " SECRETS:" TEXTCOLOR_NORMAL " %d / %d" ,
1891
+ StrFormat (line, TEXTCOLOR_RED " SECRETS:" TEXTCOLOR_NORMAL " %d / %d" ,
1892
1892
level.found_secrets , level.total_secrets );
1893
1893
int x, y;
1894
- const int text_width = V_StringWidth (line) * CleanXfac;
1894
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1895
1895
1896
1896
if (AM_OverlayAutomapVisible ())
1897
1897
{
@@ -1904,7 +1904,7 @@ void AM_Drawer()
1904
1904
y = OV_Y - (text_height * 2 ) + 1 ;
1905
1905
}
1906
1906
1907
- screen->DrawTextClean (CR_GREY, x, y, line);
1907
+ screen->DrawTextClean (CR_GREY, x, y, line. c_str () );
1908
1908
}
1909
1909
}
1910
1910
@@ -1931,11 +1931,10 @@ void AM_Drawer()
1931
1931
break ;
1932
1932
}
1933
1933
1934
- strncpy (line, GStrings.getIndex (firstmap + level.levelnum - mapoffset),
1935
- ARRAY_LENGTH (line) - 1 );
1934
+ line += GStrings.getIndex (firstmap + level.levelnum - mapoffset);
1936
1935
1937
1936
int x, y;
1938
- const int text_width = V_StringWidth (line) * CleanXfac;
1937
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1939
1938
1940
1939
if (AM_OverlayAutomapVisible ())
1941
1940
{
@@ -1948,23 +1947,35 @@ void AM_Drawer()
1948
1947
y = OV_Y - (text_height * 1 ) + 1 ;
1949
1948
}
1950
1949
1951
- screen->DrawTextClean (CR_RED, x, y, line);
1950
+ screen->DrawTextClean (CR_RED, x, y, line. c_str () );
1952
1951
}
1953
1952
else
1954
1953
{
1955
- strcpy (line, TEXTCOLOR_RED);
1956
- int pos = strlen (line);
1957
- for (int i = 0 ; i < 8 && level.mapname [i]; i++, pos++)
1958
- line[pos] = level.mapname [i];
1954
+ if (level.clearlabel )
1955
+ {
1956
+ line.clear ();
1957
+ }
1958
+ else
1959
+ {
1960
+ line = TEXTCOLOR_RED;
1961
+
1962
+ // use user provided label if one exists
1963
+ if (!level.label .empty ())
1964
+ {
1965
+ line += level.label + TEXTCOLOR_NORMAL;
1966
+ }
1967
+ else
1968
+ {
1969
+ for (int i = 0 ; i < 8 && level.mapname [i]; i++)
1970
+ line += level.mapname [i];
1971
+ line += " :" TEXTCOLOR_NORMAL " " ;
1972
+ }
1973
+ }
1959
1974
1960
- line[pos++] = ' :' ;
1961
- strcpy (line + pos, TEXTCOLOR_NORMAL);
1962
- pos = strlen (line);
1963
- line[pos++] = ' ' ;
1964
- strcpy (&line[pos], level.level_name );
1975
+ line += level.level_name ;
1965
1976
1966
1977
int x, y;
1967
- const int text_width = V_StringWidth (line) * CleanXfac;
1978
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1968
1979
1969
1980
if (AM_OverlayAutomapVisible ())
1970
1981
{
@@ -1977,16 +1988,16 @@ void AM_Drawer()
1977
1988
y = OV_Y - (text_height * 1 ) + 1 ;
1978
1989
}
1979
1990
1980
- screen->DrawTextClean (CR_GREY, x, y, line);
1991
+ screen->DrawTextClean (CR_GREY, x, y, line. c_str () );
1981
1992
}
1982
1993
1983
1994
if (am_showtime)
1984
1995
{
1985
- sprintf (line, " %02d:%02d:%02d" , time / 3600 , (time % 3600 ) / 60 ,
1996
+ StrFormat (line, " %02d:%02d:%02d" , time / 3600 , (time % 3600 ) / 60 ,
1986
1997
time % 60 ); // Time
1987
1998
1988
1999
int x, y;
1989
- const int text_width = V_StringWidth (line) * CleanXfac;
2000
+ const int text_width = V_StringWidth (line. c_str () ) * CleanXfac;
1990
2001
1991
2002
if (AM_OverlayAutomapVisible ())
1992
2003
{
@@ -1999,7 +2010,7 @@ void AM_Drawer()
1999
2010
y = OV_Y - (text_height * 1 ) + 1 ;
2000
2011
}
2001
2012
2002
- screen->DrawTextClean (CR_GREY, x, y, line);
2013
+ screen->DrawTextClean (CR_GREY, x, y, line. c_str () );
2003
2014
}
2004
2015
}
2005
2016
}
0 commit comments