X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fmiscfunctions.qh;h=d259efe66036ed21404fac890ca60b32b9d28787;hp=1f8790481f1a8d88a0193d9971d8b65b2dcbad4b;hb=991de5e6922cd3c283de56c3249624f0f1bfe767;hpb=2a38620bbb43f7b62bbd93e8c22b6abbe627ca86 diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 1f8790481f..d259efe660 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -31,10 +31,10 @@ vector HUD_GetFontsize(string cvarname); float PreviewExists(string name); -vector rotate(vector v, float a); +vector Rotate(vector v, float a); -#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : ((s).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 @@ -45,8 +45,8 @@ float cvar_or(string cv, float v); vector project_3d_to_2d(vector vec); vector drawfontscale; -#define draw_beginBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 2; } MACRO_END -#define draw_endBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 1; } MACRO_END +#define draw_beginBoldFont() drawfont = FONT_USER + 2 +#define draw_endBoldFont() drawfont = FONT_USER + 1 float expandingbox_sizefactor_from_fadelerp(float fadelerp); @@ -110,7 +110,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;\ @@ -119,43 +119,43 @@ string _drawpic_picpath; _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);\ + drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), 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);\ + 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 { \ +#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN \ float textaspect, oldsz; \ vector dfs = drawfontscale; \ drawfontscale = '1 1 0'; \ @@ -170,7 +170,7 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc sz.y = sz.x / textaspect; \ pos.y += (oldsz - sz.y) * 0.5; \ } \ -} MACRO_END +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); @@ -187,6 +187,8 @@ void drawcolorcodedstring_expanding(vector position, string text, vector theScal void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp); +void update_mousepos(); + // this draws the triangles of a model DIRECTLY. Don't expect high performance, really... float PolyDrawModelSurface(entity e, float i_s); void PolyDrawModel(entity e);