]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move SET_POS_AND_SZ_Y_ASPECT back to miscfuntions.qc, it isn't meant to be used outsi...
authorterencehill <piuntn@gmail.com>
Mon, 1 Jun 2020 11:17:59 +0000 (13:17 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 1 Jun 2020 11:17:59 +0000 (13:17 +0200)
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh

index 1af1b971ffe91272af6cfcb915c1de041cbf49a8..e6f036842c0fe81c723ebdb5988cc74b3b18d0d2 100644 (file)
@@ -332,6 +332,23 @@ float stringwidth(string text, float handleColors, vector sz)
        return r;
 }
 
+#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN \
+       float textaspect, oldsz; \
+       vector dfs = drawfontscale; \
+       drawfontscale = '1 1 0'; \
+       textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y; \
+       drawfontscale = dfs; \
+       if(sz.x/sz.y > textaspect) { \
+               oldsz = sz.x; \
+               sz.x = sz.y * textaspect; \
+               pos.x += (oldsz - sz.x) * 0.5; \
+       } else { \
+               oldsz = sz.y; \
+               sz.y = sz.x / textaspect; \
+               pos.y += (oldsz - sz.y) * 0.5; \
+       } \
+MACRO_END
+
 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag) {
        SET_POS_AND_SZ_Y_ASPECT(false);
index 3397ab7059133106f8f8a2008a44c619ac7dbafe..5641215ae950cdee1d5a0fe8c31c4851a601743e 100644 (file)
@@ -158,23 +158,6 @@ void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale,
 
 void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
 
-#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN                                                                                                                      \
-       float textaspect, oldsz;                                                                                                                                                                                \
-       vector dfs = drawfontscale; \
-       drawfontscale = '1 1 0'; \
-       textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y;                                                                                    \
-       drawfontscale = dfs; \
-       if(sz.x/sz.y > textaspect) {                                                                                                                                                                    \
-               oldsz = sz.x;                                                                                                                                                                                           \
-               sz.x = sz.y * textaspect;                                                                                                                                                                       \
-               pos.x += (oldsz - sz.x) * 0.5;                                                                                                                                                          \
-       } else {                                                                                                                                                                                                                \
-               oldsz = sz.y;                                                                                                                                                                                           \
-               sz.y = sz.x / textaspect;                                                                                                                                                                       \
-               pos.y += (oldsz - sz.y) * 0.5;                                                                                                                                                          \
-       }                                                                                                                                                                                                                               \
-MACRO_END
-
 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);