]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimize 2 macros
authorterencehill <piuntn@gmail.com>
Sat, 1 Dec 2018 19:19:08 +0000 (20:19 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 1 Dec 2018 19:19:08 +0000 (20:19 +0100)
qcsrc/client/view.qc
qcsrc/lib/yenc.qh

index ffab46236384284aa70f7b3e7538664401155bec..5172731ffb32017af4246591362dc5ec10b9a517 100644 (file)
@@ -1357,20 +1357,21 @@ void HUD_Crosshair(entity this)
 
 #define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
                        MACRO_BEGIN { \
+                               vector scaled_sz = sz * wcross_size; \
                                if(wcross_blur > 0) \
                                { \
                                        for(i = -2; i <= 2; ++i) \
                                        for(j = -2; j <= 2; ++j) \
-                                       M(i,j,sz,wcross_name,wcross_alpha*0.04); \
+                                       M(i,j,sz,scaled_sz,wcross_name,wcross_alpha*0.04); \
                                } \
                                else \
                                { \
-                                       M(0,0,sz,wcross_name,wcross_alpha); \
+                                       M(0,0,sz,scaled_sz,wcross_name,wcross_alpha); \
                                } \
                        } MACRO_END
 
-#define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \
-                       drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size.x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size.y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
+#define CROSSHAIR_DRAW_SINGLE(i,j,sz,scaled_sz,wcross_name,wcross_alpha) \
+                       drawpic(wcross_origin - ('0.5 0 0' * (scaled_sz.x + i * wcross_blur) + '0 0.5 0' * (scaled_sz.y + j * wcross_blur)), wcross_name, scaled_sz, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
 
 #define CROSSHAIR_DRAW(sz,wcross_name,wcross_alpha) \
                        CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_SINGLE,sz,wcross_name,wcross_alpha)
index a8389e240f4e9ec0041ae5609a75c2ee9baae84a..dce6e9c9d82459022ec231eeb5ee03b3f5e41c0e 100644 (file)
@@ -34,9 +34,7 @@
                if (conv <= 0) { \
                        ret = -1; \
                } else { \
-                       bool esc = false; \
                        if (conv == '=') { \
-                               esc = true; \
                                conv = STRING_ITERATOR_GET(stringiter); \
                                conv -= 64; \
                        } \