X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fmiscfunctions.qh;h=5641215ae950cdee1d5a0fe8c31c4851a601743e;hp=0143d1a0134ac1720a49273a0bb87b408156ab54;hb=c05104bde1e758c4022f9755f02f177aa0476134;hpb=2bddfb42fdbb3318aa319d228d8c99adcc90b128 diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 0143d1a013..5641215ae9 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -34,7 +34,7 @@ float PreviewExists(string name); vector Rotate(vector v, float a); -#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResourceAmount((s), RESOURCE_HEALTH) <= 0)) +#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0)) // decolorizes and team colors the player name when needed @@ -52,6 +52,9 @@ float expandingbox_sizefactor_from_fadelerp(float fadelerp); vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor); +float blink_synced(float base, float range, float freq, float start_time, int start_blink); +float blink(float base, float range, float freq); + void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag); void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag); @@ -110,7 +113,7 @@ vector _drawpic_sz; float _drawpic_oldsz; string _drawpic_picpath; #define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\ - MACRO_BEGIN {\ + MACRO_BEGIN \ _drawpic_imgsize = draw_getimagesize(pic);\ if(_drawpic_imgsize != '0 0 0') {\ _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\ @@ -127,51 +130,34 @@ string _drawpic_picpath; drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\ }\ }\ - } MACRO_END + MACRO_END // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga #define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\ - MACRO_BEGIN {\ + MACRO_BEGIN \ _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ if(precache_pic(_drawpic_picpath) == "") {\ _drawpic_picpath = strcat("gfx/hud/default/", pic);\ }\ drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ _drawpic_picpath = string_null;\ - } MACRO_END + MACRO_END // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga #define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\ - MACRO_BEGIN {\ + MACRO_BEGIN \ _drawpic_picpath = strcat(hud_skin_path, "/", pic);\ if(precache_pic(_drawpic_picpath) == "") {\ _drawpic_picpath = strcat("gfx/hud/default/", pic);\ }\ drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\ _drawpic_picpath = string_null;\ - } MACRO_END + MACRO_END void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp); 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);