From df7a60aaece8c26e5c95a328f3ab06e26439eb12 Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 27 Jan 2010 13:28:23 +0000 Subject: [PATCH] Fix expanding text; change one tokenize call because I can git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8581 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/miscfunctions.qc | 15 +++++++++++++-- data/qcsrc/server/t_items.qc | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/data/qcsrc/client/miscfunctions.qc b/data/qcsrc/client/miscfunctions.qc index 0971fe350..432b5ebf0 100644 --- a/data/qcsrc/client/miscfunctions.qc +++ b/data/qcsrc/client/miscfunctions.qc @@ -449,7 +449,11 @@ void drawstring_expanding(vector position, string text, vector scale, vector rgb else drawfontscale = '1 1 0'; dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); - drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE, '1 0 0') / drawfontscale_x), text, scale * sz, rgb, alpha * (1 - fadelerp), flag); + drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), rgb, alpha * (1 - fadelerp), flag); + // width parameter: + // (scale_x * sz / drawfontscale_x) * drawfontscale_x * SIZE1 / (scale_x * sz) + // SIZE1 + if(cvar("menu_font_size_snapping_fix")) drawfontscale = '1 1 0'; } @@ -459,6 +463,13 @@ void drawcolorcodedstring_expanding(vector position, string text, vector scale, float sz; sz = expandingbox_sizefactor_from_fadelerp(fadelerp); + if(cvar("menu_font_size_snapping_fix")) + drawfontscale = sz * '1 1 0'; + else + drawfontscale = '1 1 0'; dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); - drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE, '1 0 0')), text, scale * sz, alpha * (1 - fadelerp), flag); + drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), alpha * (1 - fadelerp), flag); + + if(cvar("menu_font_size_snapping_fix")) + drawfontscale = '1 1 0'; } diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 83f6db868..406e13b53 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -1458,7 +1458,7 @@ void spawnfunc_target_items (void) self.netname = strzone(self.netname); //print(self.netname, "\n"); - n = tokenize(self.netname); + n = tokenize_console(self.netname); for(i = 0; i < n; ++i) { for(j = WEP_FIRST; j <= WEP_LAST; ++j) -- 2.39.2