]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix draw_aspect for when the image has no size, previously the engine used to return...
authorSamual <samual@xonotic.org>
Fri, 27 Jan 2012 03:10:06 +0000 (22:10 -0500)
committerSamual <samual@xonotic.org>
Fri, 27 Jan 2012 03:10:06 +0000 (22:10 -0500)
qcsrc/client/miscfunctions.qc

index ff5dd07ff3386013b89b8a5c1684922d0dafe382..6e4e2dd87c37789c78f045aa9fb7836d94ee04b1 100644 (file)
@@ -279,18 +279,20 @@ var string _drawpic_picpath;
 #define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
        do {\
                _drawpic_imgsize = draw_getimagesize(pic);\
-               _drawpic_imgaspect = _drawpic_imgsize_x/_drawpic_imgsize_y;\
-               _drawpic_sz = mySize;\
-               if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\
-                       _drawpic_oldsz = _drawpic_sz_x;\
-                       _drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\
-                       if(_drawpic_sz_x)\
-                               drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
-               } else {\
-                       _drawpic_oldsz = _drawpic_sz_y;\
-                       _drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\
-                       if(_drawpic_sz_y)\
-                               drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+               if(_drawpic_imgsize != '0 0 0') {\
+                       _drawpic_imgaspect = _drawpic_imgsize_x/_drawpic_imgsize_y;\
+                       _drawpic_sz = mySize;\
+                       if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\
+                               _drawpic_oldsz = _drawpic_sz_x;\
+                               _drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\
+                               if(_drawpic_sz_x)\
+                                       drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                       } else {\
+                               _drawpic_oldsz = _drawpic_sz_y;\
+                               _drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\
+                               if(_drawpic_sz_y)\
+                                       drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                       }\
                }\
        } while(0)