From: Samual Date: Fri, 27 Jan 2012 03:10:06 +0000 (-0500) Subject: Fix draw_aspect for when the image has no size, previously the engine used to return... X-Git-Tag: xonotic-v0.6.0~78^2^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=69c1bc26454d9463f951f55d9b3f4f419483c227;p=xonotic%2Fxonotic-data.pk3dir.git Fix draw_aspect for when the image has no size, previously the engine used to return '16 16 0' (notexture size), now it returns just '0 0 0', so just check for this in the macro. --- diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index ff5dd07ff..6e4e2dd87 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -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)